2017-11-09 23:27:50 +03:00
|
|
|
/* $NetBSD: cmd3.c,v 1.44 2017/11/09 20:27:50 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[] = "@(#)cmd3.c 8.2 (Berkeley) 4/20/95";
|
1996-06-08 23:48:09 +04:00
|
|
|
#else
|
2017-11-09 23:27:50 +03:00
|
|
|
__RCSID("$NetBSD: cmd3.c,v 1.44 2017/11/09 20:27:50 christos Exp $");
|
1996-06-08 23:48:09 +04:00
|
|
|
#endif
|
1993-03-21 12:45:37 +03:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#include "rcv.h"
|
2007-10-30 05:28:30 +03:00
|
|
|
#include <assert.h>
|
2006-10-22 01:37:20 +04:00
|
|
|
#include <util.h>
|
1994-06-29 09:09:04 +04:00
|
|
|
#include "extern.h"
|
2006-10-22 01:37:20 +04:00
|
|
|
#include "mime.h"
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
#include "sig.h"
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
#include "thread.h"
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Mail -- a mail program
|
|
|
|
*
|
|
|
|
* Still more user commands.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
* Do a dictionary order comparison of the arguments from
|
|
|
|
* qsort.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static int
|
|
|
|
diction(const void *a, const void *b)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return strcmp(*(const char *const *)a, *(const char *const *)b);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
* Sort the passed string vector into ascending dictionary
|
|
|
|
* order.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC void
|
|
|
|
sort(const char **list)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char **ap;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
for (ap = list; *ap != NULL; ap++)
|
|
|
|
continue;
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
if (ap - list < 2)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return;
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
qsort(list, (size_t)(ap - list), sizeof(*list), diction);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Expand the shell escape by expanding unescaped !'s into the
|
|
|
|
* last issued command where possible.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static int
|
2002-03-02 17:59:35 +03:00
|
|
|
bangexp(char *str)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static char lastbang[128];
|
|
|
|
char bangbuf[LINESIZE];
|
1997-10-19 09:02:57 +04:00
|
|
|
char *cp, *cp2;
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
ssize_t n;
|
|
|
|
int changed;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
changed = 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
cp = str;
|
|
|
|
cp2 = bangbuf;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
n = sizeof(bangbuf); /* bytes left in bangbuf */
|
1993-03-21 12:45:37 +03:00
|
|
|
while (*cp) {
|
|
|
|
if (*cp == '!') {
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (n < (int)strlen(lastbang)) {
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
overf:
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("Command buffer overflow\n");
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return -1;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
changed++;
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)strcpy(cp2, lastbang);
|
1993-03-21 12:45:37 +03:00
|
|
|
cp2 += strlen(lastbang);
|
|
|
|
n -= strlen(lastbang);
|
|
|
|
cp++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (*cp == '\\' && cp[1] == '!') {
|
|
|
|
if (--n <= 1)
|
|
|
|
goto overf;
|
|
|
|
*cp2++ = '!';
|
|
|
|
cp += 2;
|
|
|
|
changed++;
|
|
|
|
}
|
|
|
|
if (--n <= 1)
|
|
|
|
goto overf;
|
|
|
|
*cp2++ = *cp++;
|
|
|
|
}
|
|
|
|
*cp2 = 0;
|
|
|
|
if (changed) {
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("!%s\n", bangbuf);
|
|
|
|
(void)fflush(stdout);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)strcpy(str, bangbuf);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
(void)strlcpy(lastbang, bangbuf, sizeof(lastbang));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process a shell escape by saving signals, ignoring signals,
|
|
|
|
* and forking a sh -c
|
|
|
|
*/
|
|
|
|
PUBLIC int
|
|
|
|
shell(void *v)
|
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
struct sigaction osa;
|
|
|
|
sigset_t oset;
|
|
|
|
char *str;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char *shellcmd;
|
|
|
|
char cmd[LINESIZE];
|
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
str = v;
|
|
|
|
sig_check();
|
|
|
|
(void)sig_ignore(SIGINT, &osa, &oset);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
(void)strcpy(cmd, str);
|
|
|
|
if (bangexp(cmd) < 0)
|
|
|
|
return 1;
|
|
|
|
if ((shellcmd = value(ENAME_SHELL)) == NULL)
|
|
|
|
shellcmd = _PATH_CSHELL;
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
(void)run_command(shellcmd, NULL, 0, 1, "-c", cmd, NULL);
|
|
|
|
(void)sig_restore(SIGINT, &osa, &oset);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
(void)printf("!\n");
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
sig_check();
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fork an interactive shell.
|
|
|
|
*/
|
|
|
|
/*ARGSUSED*/
|
|
|
|
PUBLIC int
|
|
|
|
dosh(void *v __unused)
|
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
struct sigaction osa;
|
|
|
|
sigset_t oset;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char *shellcmd;
|
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
sig_check();
|
|
|
|
(void)sig_ignore(SIGINT, &osa, &oset);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if ((shellcmd = value(ENAME_SHELL)) == NULL)
|
|
|
|
shellcmd = _PATH_CSHELL;
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
(void)run_command(shellcmd, NULL, 0, 1, NULL);
|
|
|
|
(void)sig_restore(SIGINT, &osa, &oset);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
(void)putchar('\n');
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
sig_check();
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print out a nice help message from some file or another.
|
|
|
|
*/
|
|
|
|
|
2005-07-20 03:07:10 +04:00
|
|
|
/*ARGSUSED*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2006-10-22 01:37:20 +04:00
|
|
|
help(void *v __unused)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
|
2007-06-05 21:50:22 +04:00
|
|
|
cathelp(_PATH_HELP);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Change user's working directory.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
schdir(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
char **arglist;
|
2005-07-19 05:38:38 +04:00
|
|
|
const char *cp;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
arglist = v;
|
2002-03-04 06:07:25 +03:00
|
|
|
if (*arglist == NULL)
|
1993-03-21 12:45:37 +03:00
|
|
|
cp = homedir;
|
|
|
|
else
|
2002-03-04 06:07:25 +03:00
|
|
|
if ((cp = expand(*arglist)) == NULL)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
if (chdir(cp) < 0) {
|
2002-03-06 00:29:30 +03:00
|
|
|
warn("%s", cp);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/*
|
|
|
|
* Return the smopts field if "ReplyAsRecipient" is defined.
|
|
|
|
*/
|
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
|
|
|
static struct name *
|
|
|
|
set_smopts(struct message *mp)
|
|
|
|
{
|
|
|
|
char *cp;
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
struct name *np;
|
|
|
|
char *reply_as_recipient;
|
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
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
np = NULL;
|
|
|
|
reply_as_recipient = value(ENAME_REPLYASRECIPIENT);
|
2006-09-20 00:31:49 +04:00
|
|
|
if (reply_as_recipient &&
|
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
|
|
|
(cp = skin(hfield("to", mp))) != NULL &&
|
2006-09-20 00:31:49 +04:00
|
|
|
extract(cp, GTO)->n_flink == NULL) { /* check for one recipient */
|
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
|
|
|
char *p, *q;
|
2006-10-22 01:37:20 +04:00
|
|
|
size_t len = strlen(cp);
|
|
|
|
/*
|
|
|
|
* XXX - perhaps we always want to ignore
|
|
|
|
* "undisclosed-recipients:;" ?
|
|
|
|
*/
|
|
|
|
for (p = q = reply_as_recipient; *p; p = q) {
|
2007-10-23 18:58:43 +04:00
|
|
|
while (*q != '\0' && *q != ',' && !is_WSP(*q))
|
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
|
|
|
q++;
|
2006-10-22 01:37:20 +04:00
|
|
|
if (p + len == q && strncasecmp(cp, p, len) == 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
|
|
|
return np;
|
2007-10-23 18:58:43 +04:00
|
|
|
while (*q == ',' || is_WSP(*q))
|
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
|
|
|
q++;
|
|
|
|
}
|
|
|
|
np = extract(__UNCONST("-f"), GSMOPTS);
|
|
|
|
np = cat(np, extract(cp, GSMOPTS));
|
|
|
|
}
|
|
|
|
|
|
|
|
return np;
|
|
|
|
}
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/*
|
|
|
|
* Modify the subject we are replying to to begin with Re: if
|
|
|
|
* it does not already.
|
|
|
|
*/
|
|
|
|
static char *
|
2007-10-30 05:28:30 +03:00
|
|
|
reedit(char *subj, const char *pref)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
{
|
|
|
|
char *newsubj;
|
2007-10-30 05:28:30 +03:00
|
|
|
size_t preflen;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
|
2007-10-30 05:28:30 +03:00
|
|
|
assert(pref != NULL);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (subj == NULL)
|
2007-10-30 05:28:30 +03:00
|
|
|
return __UNCONST(pref);
|
|
|
|
preflen = strlen(pref);
|
|
|
|
if (strncasecmp(subj, pref, preflen) == 0)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return subj;
|
2007-10-30 05:28:30 +03:00
|
|
|
newsubj = salloc(strlen(subj) + preflen + 1 + 1);
|
|
|
|
(void)sprintf(newsubj, "%s %s", pref, subj);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return newsubj;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the "In-Reply-To" and "References" header fields appropriately.
|
|
|
|
* Used in replies.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
set_ident_fields(struct header *hp, struct message *mp)
|
|
|
|
{
|
|
|
|
char *in_reply_to;
|
|
|
|
char *references;
|
|
|
|
|
|
|
|
in_reply_to = hfield("message-id", mp);
|
|
|
|
hp->h_in_reply_to = in_reply_to;
|
|
|
|
|
|
|
|
references = hfield("references", mp);
|
|
|
|
hp->h_references = extract(references, GMISC);
|
|
|
|
hp->h_references = cat(hp->h_references, extract(in_reply_to, GMISC));
|
|
|
|
}
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* Reply to a list of messages. Extract each name from the
|
|
|
|
* message header and send them off to mail1()
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static int
|
2007-10-27 19:14:50 +04:00
|
|
|
respond_core(int *msgvec)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
struct message *mp;
|
|
|
|
char *cp, *rcv, *replyto;
|
|
|
|
char **ap;
|
|
|
|
struct name *np;
|
|
|
|
struct header head;
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/* ensure that all header fields are initially NULL */
|
|
|
|
(void)memset(&head, 0, sizeof(head));
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
if (msgvec[1] != 0) {
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("Sorry, can't reply to multiple messages at once\n");
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
mp = get_message(msgvec[0]);
|
1993-03-21 12:45:37 +03:00
|
|
|
touch(mp);
|
|
|
|
dot = mp;
|
2002-03-04 06:07:25 +03:00
|
|
|
if ((rcv = skin(hfield("from", mp))) == NULL)
|
1993-03-21 12:45:37 +03:00
|
|
|
rcv = skin(nameof(mp, 1));
|
2002-03-04 06:07:25 +03:00
|
|
|
if ((replyto = skin(hfield("reply-to", mp))) != NULL)
|
1993-03-21 12:45:37 +03:00
|
|
|
np = extract(replyto, GTO);
|
2002-03-04 06:07:25 +03:00
|
|
|
else if ((cp = skin(hfield("to", mp))) != NULL)
|
1993-03-21 12:45:37 +03:00
|
|
|
np = extract(cp, GTO);
|
|
|
|
else
|
2002-03-04 06:16:10 +03:00
|
|
|
np = NULL;
|
1993-03-21 12:45:37 +03:00
|
|
|
np = elide(np);
|
|
|
|
/*
|
|
|
|
* Delete my name from the reply list,
|
|
|
|
* and with it, all my alternate names.
|
|
|
|
*/
|
|
|
|
np = delname(np, myname);
|
|
|
|
if (altnames)
|
|
|
|
for (ap = altnames; *ap; ap++)
|
|
|
|
np = delname(np, *ap);
|
2002-03-04 06:16:10 +03:00
|
|
|
if (np != NULL && replyto == NULL)
|
1993-03-21 12:45:37 +03:00
|
|
|
np = cat(np, extract(rcv, GTO));
|
2002-03-04 06:16:10 +03:00
|
|
|
else if (np == NULL) {
|
2002-03-04 06:07:25 +03:00
|
|
|
if (replyto != NULL)
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("Empty reply-to field -- replying to author\n");
|
1993-03-21 12:45:37 +03:00
|
|
|
np = extract(rcv, GTO);
|
|
|
|
}
|
|
|
|
head.h_to = np;
|
2002-03-04 06:07:25 +03:00
|
|
|
if ((head.h_subject = hfield("subject", mp)) == NULL)
|
1993-03-21 12:45:37 +03:00
|
|
|
head.h_subject = hfield("subj", mp);
|
2007-10-30 05:28:30 +03:00
|
|
|
head.h_subject = reedit(head.h_subject, "Re:");
|
2002-03-04 06:07:25 +03:00
|
|
|
if (replyto == NULL && (cp = skin(hfield("cc", mp))) != NULL) {
|
1993-03-21 12:45:37 +03:00
|
|
|
np = elide(extract(cp, GCC));
|
|
|
|
np = delname(np, myname);
|
|
|
|
if (altnames != 0)
|
|
|
|
for (ap = altnames; *ap; ap++)
|
|
|
|
np = delname(np, *ap);
|
|
|
|
head.h_cc = np;
|
|
|
|
} else
|
2002-03-04 06:16:10 +03:00
|
|
|
head.h_cc = NULL;
|
|
|
|
head.h_bcc = NULL;
|
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
|
|
|
head.h_smopts = set_smopts(mp);
|
2006-10-22 01:37:20 +04:00
|
|
|
#ifdef MIME_SUPPORT
|
|
|
|
head.h_attach = NULL;
|
|
|
|
#endif
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
set_ident_fields(&head, mp);
|
1993-03-21 12:45:37 +03:00
|
|
|
mail1(&head, 1);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
* Reply to a series of messages by simply mailing to the senders
|
|
|
|
* and not messing around with the To: and Cc: lists as in normal
|
|
|
|
* reply.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static int
|
2007-10-27 19:14:50 +04:00
|
|
|
Respond_core(int msgvec[])
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
struct header head;
|
|
|
|
struct message *mp;
|
|
|
|
int *ap;
|
|
|
|
char *cp;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/* ensure that all header fields are initially NULL */
|
|
|
|
(void)memset(&head, 0, sizeof(head));
|
|
|
|
|
|
|
|
head.h_to = NULL;
|
|
|
|
for (ap = msgvec; *ap != 0; ap++) {
|
|
|
|
mp = get_message(*ap);
|
|
|
|
touch(mp);
|
|
|
|
dot = mp;
|
|
|
|
if ((cp = skin(hfield("from", mp))) == NULL)
|
|
|
|
cp = skin(nameof(mp, 2));
|
|
|
|
head.h_to = cat(head.h_to, extract(cp, GTO));
|
|
|
|
}
|
|
|
|
if (head.h_to == NULL)
|
|
|
|
return 0;
|
|
|
|
mp = get_message(msgvec[0]);
|
|
|
|
if ((head.h_subject = hfield("subject", mp)) == NULL)
|
|
|
|
head.h_subject = hfield("subj", mp);
|
2007-10-30 05:28:30 +03:00
|
|
|
head.h_subject = reedit(head.h_subject, "Re:");
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
head.h_cc = NULL;
|
|
|
|
head.h_bcc = NULL;
|
|
|
|
head.h_smopts = set_smopts(mp);
|
|
|
|
#ifdef MIME_SUPPORT
|
|
|
|
head.h_attach = NULL;
|
|
|
|
#endif
|
|
|
|
set_ident_fields(&head, mp);
|
|
|
|
mail1(&head, 1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
PUBLIC int
|
|
|
|
respond(void *v)
|
|
|
|
{
|
|
|
|
int *msgvec = v;
|
|
|
|
if (value(ENAME_REPLYALL) == NULL)
|
2007-10-27 19:14:50 +04:00
|
|
|
return respond_core(msgvec);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
else
|
2007-10-27 19:14:50 +04:00
|
|
|
return Respond_core(msgvec);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
PUBLIC int
|
|
|
|
Respond(void *v)
|
|
|
|
{
|
|
|
|
int *msgvec = v;
|
|
|
|
if (value(ENAME_REPLYALL) == NULL)
|
2007-10-27 19:14:50 +04:00
|
|
|
return Respond_core(msgvec);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
else
|
2007-10-27 19:14:50 +04:00
|
|
|
return respond_core(msgvec);
|
|
|
|
}
|
|
|
|
|
2007-10-30 19:08:11 +03:00
|
|
|
#ifdef MIME_SUPPORT
|
2007-10-30 05:28:30 +03:00
|
|
|
static int
|
|
|
|
forward_one(int msgno, struct name *h_to)
|
|
|
|
{
|
|
|
|
struct attachment attach;
|
|
|
|
struct message *mp;
|
|
|
|
struct header hdr;
|
|
|
|
|
|
|
|
mp = get_message(msgno);
|
|
|
|
if (mp == NULL) {
|
|
|
|
(void)printf("no such message %d\n", msgno);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
(void)printf("message %d\n", msgno);
|
|
|
|
|
|
|
|
(void)memset(&attach, 0, sizeof(attach));
|
|
|
|
attach.a_type = ATTACH_MSG;
|
|
|
|
attach.a_msg = mp;
|
|
|
|
attach.a_Content = get_mime_content(&attach, 0);
|
|
|
|
|
|
|
|
(void)memset(&hdr, 0, sizeof(hdr));
|
|
|
|
hdr.h_to = h_to;
|
|
|
|
if ((hdr.h_subject = hfield("subject", mp)) == NULL)
|
|
|
|
hdr.h_subject = hfield("subj", mp);
|
|
|
|
hdr.h_subject = reedit(hdr.h_subject, "Fwd:");
|
|
|
|
hdr.h_attach = &attach;
|
|
|
|
hdr.h_smopts = set_smopts(mp);
|
|
|
|
|
|
|
|
set_ident_fields(&hdr, mp);
|
|
|
|
mail1(&hdr, 1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-10-27 19:14:50 +04:00
|
|
|
PUBLIC int
|
|
|
|
forward(void *v)
|
|
|
|
{
|
|
|
|
int *msgvec = v;
|
|
|
|
int *ip;
|
2007-10-30 05:28:30 +03:00
|
|
|
struct header hdr;
|
|
|
|
int rval;
|
|
|
|
|
|
|
|
if (forwardtab[0].i_count == 0) {
|
|
|
|
/* setup the forward tab */
|
|
|
|
add_ignore("Status", forwardtab);
|
|
|
|
}
|
|
|
|
(void)memset(&hdr, 0, sizeof(hdr));
|
|
|
|
if ((rval = grabh(&hdr, GTO)) != 0)
|
|
|
|
return rval;
|
|
|
|
|
|
|
|
if (hdr.h_to == NULL) {
|
|
|
|
(void)printf("address missing!\n");
|
|
|
|
return 1;
|
|
|
|
}
|
2009-04-11 18:22:32 +04:00
|
|
|
for (ip = msgvec; *ip; ip++) {
|
2007-10-30 05:28:30 +03:00
|
|
|
int e;
|
|
|
|
if ((e = forward_one(*ip, hdr.h_to)) != 0)
|
|
|
|
return e;
|
|
|
|
}
|
2007-10-27 19:14:50 +04:00
|
|
|
return 0;
|
|
|
|
}
|
2007-10-30 19:08:11 +03:00
|
|
|
#endif /* MIME_SUPPORT */
|
2007-10-27 19:14:50 +04:00
|
|
|
|
|
|
|
static int
|
|
|
|
bounce_one(int msgno, const char **smargs, struct name *h_to)
|
|
|
|
{
|
|
|
|
char mailtempname[PATHSIZE];
|
|
|
|
struct message *mp;
|
|
|
|
int fd;
|
|
|
|
FILE *obuf;
|
|
|
|
int rval;
|
|
|
|
|
|
|
|
rval = 0;
|
|
|
|
|
|
|
|
obuf = NULL;
|
|
|
|
(void)snprintf(mailtempname, sizeof(mailtempname),
|
|
|
|
"%s/mail.RsXXXXXXXXXX", tmpdir);
|
|
|
|
if ((fd = mkstemp(mailtempname)) == -1 ||
|
2017-11-09 23:27:50 +03:00
|
|
|
(obuf = Fdopen(fd, "wef+")) == NULL) {
|
2007-10-27 19:14:50 +04:00
|
|
|
if (fd != -1)
|
|
|
|
(void)close(fd);
|
|
|
|
warn("%s", mailtempname);
|
|
|
|
rval = 1;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
(void)rm(mailtempname);
|
|
|
|
|
|
|
|
mp = get_message(msgno);
|
|
|
|
|
|
|
|
if (mp == NULL) {
|
|
|
|
(void)printf("no such message %d\n", msgno);
|
|
|
|
rval = 1;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
char *cp;
|
|
|
|
char **ap;
|
|
|
|
struct name *np;
|
|
|
|
struct header hdr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Construct and output a new "To:" field:
|
|
|
|
* Remove our address from anything in the old "To:" field
|
|
|
|
* and append that list to the bounce address(es).
|
|
|
|
*/
|
|
|
|
np = NULL;
|
|
|
|
if ((cp = skin(hfield("to", mp))) != NULL)
|
|
|
|
np = extract(cp, GTO);
|
|
|
|
np = delname(np, myname);
|
|
|
|
if (altnames)
|
|
|
|
for (ap = altnames; *ap; ap++)
|
|
|
|
np = delname(np, *ap);
|
|
|
|
np = cat(h_to, np);
|
|
|
|
(void)memset(&hdr, 0, sizeof(hdr));
|
|
|
|
hdr.h_to = elide(np);
|
|
|
|
(void)puthead(&hdr, obuf, GTO | GCOMMA);
|
|
|
|
}
|
|
|
|
if (sendmessage(mp, obuf, bouncetab, NULL, NULL)) {
|
|
|
|
(void)printf("bounce failed for message %d\n", msgno);
|
|
|
|
rval = 1;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
rewind(obuf); /* XXX - here or inside mail2() */
|
|
|
|
mail2(obuf, smargs);
|
|
|
|
done:
|
|
|
|
if (obuf)
|
|
|
|
(void)Fclose(obuf);
|
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
PUBLIC int
|
|
|
|
bounce(void *v)
|
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
int *msgvec;
|
2007-10-27 19:14:50 +04:00
|
|
|
int *ip;
|
|
|
|
const char **smargs;
|
|
|
|
struct header hdr;
|
|
|
|
int rval;
|
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
msgvec = v;
|
2007-10-27 19:14:50 +04:00
|
|
|
if (bouncetab[0].i_count == 0) {
|
|
|
|
/* setup the bounce tab */
|
|
|
|
add_ignore("Status", bouncetab);
|
|
|
|
add_ignore("Delivered-To", bouncetab);
|
|
|
|
add_ignore("To", bouncetab);
|
|
|
|
add_ignore("X-Original-To", bouncetab);
|
|
|
|
}
|
|
|
|
(void)memset(&hdr, 0, sizeof(hdr));
|
|
|
|
if ((rval = grabh(&hdr, GTO)) != 0)
|
|
|
|
return rval;
|
|
|
|
|
|
|
|
if (hdr.h_to == NULL)
|
|
|
|
return 1;
|
|
|
|
|
Fix various security related issues:
0001. Do not recognize paths, mail folders, and pipes in mail addresses
by default. That avoids a direct command injection with syntactically
valid email addresses starting with |.
Such addresses can be specified both on the command line, the mail
headers (with -t) or in address lines copied over from previous
while replying.
This was assigned CVE-2014-7844 for some versions of BSD mailx. It is
documented behavior for Heirloom mailx, and was mentioned in an old
technical report about BSD mailx (which does not usually make its way
into operating system installations). The patch switches off this
processing and updates the documentation.
Added expandaddr option to explicitly enable this behavior.
0002. When invoking sendmail, prevent option processing for email
address arguments. This prevents changing e.g. the Postfix
configuration file in unexpected ways. This behavior was documented for
BSD mailx (sort of), but not for Heirloom mailx. We did not assign a
CVE to this because it is more of a missing feature, and code invoking
mailx needs adjustment in the caller as well.
Fixed.
0003. Make wordexp support mandatory. (No functional change.)
Fixed (replaced explicit shell pipe implementation).
0004. Prevent command execution in the expand function, which is IMHO
unexpected. (Not really required with patch 1, and there is still
information disclosure/DoS potential if this expansion occurs.) This is
a historic vulnerability already fixed in the Debian package,
retroactively assigned CVE-2004-2771:
Fixed (as part of the pipe replacement with wordexp).
2014-12-16 22:30:24 +03:00
|
|
|
smargs = unpack(NULL, hdr.h_to);
|
2009-04-11 18:22:32 +04:00
|
|
|
for (ip = msgvec; *ip; ip++) {
|
2007-10-27 19:14:50 +04:00
|
|
|
int e;
|
|
|
|
if ((e = bounce_one(*ip, smargs, hdr.h_to)) != 0)
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Preserve the named messages, so that they will be sent
|
|
|
|
* back to the system mailbox.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
preserve(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
int *msgvec;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
int *ip;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
msgvec = v;
|
1993-03-21 12:45:37 +03:00
|
|
|
if (edit) {
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("Cannot \"preserve\" in edit mode\n");
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
for (ip = msgvec; *ip != 0; ip++)
|
|
|
|
dot = set_m_flag(*ip, ~(MBOX | MPRESERVE), MPRESERVE);
|
|
|
|
|
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
* Mark all given messages as unread, preserving the new status.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
unread(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
int *msgvec;
|
1997-10-19 09:02:57 +04:00
|
|
|
int *ip;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
msgvec = v;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
for (ip = msgvec; *ip != 0; ip++)
|
|
|
|
dot = set_m_flag(*ip, ~(MREAD | MTOUCH | MSTATUS), MSTATUS);
|
|
|
|
|
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
2006-10-31 23:07:32 +03:00
|
|
|
/*
|
|
|
|
* Mark all given messages as read.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2006-10-31 23:07:32 +03:00
|
|
|
markread(void *v)
|
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
int *msgvec;
|
2006-10-31 23:07:32 +03:00
|
|
|
int *ip;
|
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
msgvec = v;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
for (ip = msgvec; *ip != 0; ip++)
|
|
|
|
dot = set_m_flag(*ip,
|
|
|
|
~(MNEW | MTOUCH | MREAD | MSTATUS), MREAD | MSTATUS);
|
|
|
|
|
|
|
|
return 0;
|
2006-10-31 23:07:32 +03:00
|
|
|
}
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* Print the size of each message.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
messize(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
int *msgvec;
|
1997-10-19 09:02:57 +04:00
|
|
|
struct message *mp;
|
|
|
|
int *ip, mesg;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.
- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.
- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.
- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.
- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.
- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.
- Lint cleanup.
- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.
- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".
- Document the "pager-off" variable: if set, it disables paging
entirely.
2009-04-10 17:08:24 +04:00
|
|
|
msgvec = v;
|
1997-05-17 23:47:50 +04:00
|
|
|
for (ip = msgvec; *ip != 0; ip++) {
|
1993-03-21 12:45:37 +03:00
|
|
|
mesg = *ip;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
mp = get_message(mesg);
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("%d: %ld/%llu\n", mesg, mp->m_blines,
|
|
|
|
(unsigned long long)mp->m_size);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Quit quickly. If we are sourcing, just pop the input level
|
|
|
|
* by returning an error.
|
|
|
|
*/
|
2005-07-20 03:07:10 +04:00
|
|
|
/*ARGSUSED*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2006-10-22 01:37:20 +04:00
|
|
|
rexit(void *v __unused)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
if (sourcing)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 1;
|
1996-06-08 23:48:09 +04:00
|
|
|
exit(0);
|
1993-03-21 12:45:37 +03:00
|
|
|
/*NOTREACHED*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set or display a variable value. Syntax is similar to that
|
|
|
|
* of csh.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
set(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char **arglist = v;
|
1997-10-19 09:02:57 +04:00
|
|
|
struct var *vp;
|
2005-07-19 05:38:38 +04:00
|
|
|
const char *cp;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
char varbuf[LINESIZE];
|
|
|
|
const char **ap, **p;
|
1993-03-21 12:45:37 +03:00
|
|
|
int errs, h, s;
|
2003-10-31 04:25:54 +03:00
|
|
|
size_t l;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2002-03-04 06:07:25 +03:00
|
|
|
if (*arglist == NULL) {
|
1993-03-21 12:45:37 +03:00
|
|
|
for (h = 0, s = 1; h < HSHSIZE; h++)
|
2002-03-04 06:16:10 +03:00
|
|
|
for (vp = variables[h]; vp != NULL; vp = vp->v_link)
|
1993-03-21 12:45:37 +03:00
|
|
|
s++;
|
2007-10-30 02:20:37 +03:00
|
|
|
ap = salloc(s * sizeof(*ap));
|
1993-03-21 12:45:37 +03:00
|
|
|
for (h = 0, p = ap; h < HSHSIZE; h++)
|
2002-03-04 06:16:10 +03:00
|
|
|
for (vp = variables[h]; vp != NULL; vp = vp->v_link)
|
1993-03-21 12:45:37 +03:00
|
|
|
*p++ = vp->v_name;
|
2002-03-04 06:07:25 +03:00
|
|
|
*p = NULL;
|
1993-03-21 12:45:37 +03:00
|
|
|
sort(ap);
|
2002-03-04 06:07:25 +03:00
|
|
|
for (p = ap; *p != NULL; p++)
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("%s\t%s\n", *p, value(*p));
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
errs = 0;
|
2002-03-04 06:07:25 +03:00
|
|
|
for (ap = arglist; *ap != NULL; ap++) {
|
1993-03-21 12:45:37 +03:00
|
|
|
cp = *ap;
|
|
|
|
while (*cp != '=' && *cp != '\0')
|
2003-10-31 04:25:54 +03:00
|
|
|
++cp;
|
|
|
|
l = cp - *ap;
|
2007-10-30 02:20:37 +03:00
|
|
|
if (l >= sizeof(varbuf))
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
l = sizeof(varbuf) - 1;
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)strncpy(varbuf, *ap, l);
|
2003-11-11 00:37:36 +03:00
|
|
|
varbuf[l] = '\0';
|
1993-03-21 12:45:37 +03:00
|
|
|
if (*cp == '\0')
|
|
|
|
cp = "";
|
|
|
|
else
|
|
|
|
cp++;
|
|
|
|
if (equal(varbuf, "")) {
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("Non-null variable name required\n");
|
1993-03-21 12:45:37 +03:00
|
|
|
errs++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
assign(varbuf, cp);
|
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return errs;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Unset a bunch of variable values.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
unset(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1996-06-08 23:48:09 +04:00
|
|
|
char **arglist = v;
|
1997-10-19 09:02:57 +04:00
|
|
|
struct var *vp, *vp2;
|
1993-03-21 12:45:37 +03:00
|
|
|
int errs, h;
|
|
|
|
char **ap;
|
|
|
|
|
|
|
|
errs = 0;
|
2002-03-04 06:07:25 +03:00
|
|
|
for (ap = arglist; *ap != NULL; ap++) {
|
2002-03-04 06:16:10 +03:00
|
|
|
if ((vp2 = lookup(*ap)) == NULL) {
|
1999-02-09 07:51:30 +03:00
|
|
|
if (getenv(*ap)) {
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)unsetenv(*ap);
|
1999-02-09 07:51:30 +03:00
|
|
|
} else if (!sourcing) {
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("\"%s\": undefined variable\n", *ap);
|
1993-03-21 12:45:37 +03:00
|
|
|
errs++;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
h = hash(*ap);
|
|
|
|
if (vp2 == variables[h]) {
|
|
|
|
variables[h] = variables[h]->v_link;
|
1998-10-08 21:36:55 +04:00
|
|
|
v_free(vp2->v_name);
|
|
|
|
v_free(vp2->v_value);
|
2005-07-20 03:07:10 +04:00
|
|
|
free(vp2);
|
1993-03-21 12:45:37 +03:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
for (vp = variables[h]; vp->v_link != vp2; vp = vp->v_link)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
continue;
|
1993-03-21 12:45:37 +03:00
|
|
|
vp->v_link = vp2->v_link;
|
1998-10-08 21:36:55 +04:00
|
|
|
v_free(vp2->v_name);
|
|
|
|
v_free(vp2->v_value);
|
2005-07-20 03:07:10 +04:00
|
|
|
free(vp2);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return errs;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Show a variable value.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
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
|
|
|
show(void *v)
|
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char **arglist = v;
|
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
|
|
|
struct var *vp;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char **ap, **p;
|
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
|
|
|
int h, s;
|
|
|
|
|
|
|
|
if (*arglist == NULL) {
|
|
|
|
for (h = 0, s = 1; h < HSHSIZE; h++)
|
|
|
|
for (vp = variables[h]; vp != NULL; vp = vp->v_link)
|
|
|
|
s++;
|
2007-10-30 02:20:37 +03:00
|
|
|
ap = salloc(s * sizeof(*ap));
|
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
|
|
|
for (h = 0, p = ap; h < HSHSIZE; h++)
|
|
|
|
for (vp = variables[h]; vp != NULL; vp = vp->v_link)
|
|
|
|
*p++ = vp->v_name;
|
|
|
|
*p = NULL;
|
|
|
|
sort(ap);
|
|
|
|
for (p = ap; *p != NULL; p++)
|
|
|
|
(void)printf("%s=%s\n", *p, value(*p));
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 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
|
|
|
}
|
|
|
|
|
|
|
|
for (ap = arglist; *ap != NULL; ap++) {
|
|
|
|
char *val = value(*ap);
|
|
|
|
(void)printf("%s=%s\n", *ap, val ? val : "<null>");
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-10-31 23:07:32 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* Put add users to a group.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
group(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char **argv = v;
|
1997-10-19 09:02:57 +04:00
|
|
|
struct grouphead *gh;
|
|
|
|
struct group *gp;
|
|
|
|
int h;
|
1993-03-21 12:45:37 +03:00
|
|
|
int s;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
const char *gname;
|
|
|
|
const char **ap, **p;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2002-03-04 06:07:25 +03:00
|
|
|
if (*argv == NULL) {
|
1993-03-21 12:45:37 +03:00
|
|
|
for (h = 0, s = 1; h < HSHSIZE; h++)
|
2002-03-04 06:16:10 +03:00
|
|
|
for (gh = groups[h]; gh != NULL; gh = gh->g_link)
|
1993-03-21 12:45:37 +03:00
|
|
|
s++;
|
2007-10-30 02:20:37 +03:00
|
|
|
ap = salloc(s * sizeof(*ap));
|
1993-03-21 12:45:37 +03:00
|
|
|
for (h = 0, p = ap; h < HSHSIZE; h++)
|
2002-03-04 06:16:10 +03:00
|
|
|
for (gh = groups[h]; gh != NULL; gh = gh->g_link)
|
1993-03-21 12:45:37 +03:00
|
|
|
*p++ = gh->g_name;
|
2002-03-04 06:07:25 +03:00
|
|
|
*p = NULL;
|
1993-03-21 12:45:37 +03:00
|
|
|
sort(ap);
|
2002-03-04 06:07:25 +03:00
|
|
|
for (p = ap; *p != NULL; p++)
|
1993-03-21 12:45:37 +03:00
|
|
|
printgroup(*p);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
2002-03-04 06:07:25 +03:00
|
|
|
if (argv[1] == NULL) {
|
1993-03-21 12:45:37 +03:00
|
|
|
printgroup(*argv);
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
gname = *argv;
|
|
|
|
h = hash(gname);
|
2002-03-04 06:16:10 +03:00
|
|
|
if ((gh = findgroup(gname)) == NULL) {
|
2007-10-30 02:20:37 +03:00
|
|
|
gh = ecalloc(1, sizeof(*gh));
|
1993-03-21 12:45:37 +03:00
|
|
|
gh->g_name = vcopy(gname);
|
2002-03-04 06:16:10 +03:00
|
|
|
gh->g_list = NULL;
|
1993-03-21 12:45:37 +03:00
|
|
|
gh->g_link = groups[h];
|
|
|
|
groups[h] = gh;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Insert names from the command list into the group.
|
|
|
|
* Who cares if there are duplicates? They get tossed
|
|
|
|
* later anyway.
|
|
|
|
*/
|
|
|
|
|
2006-10-22 01:37:20 +04:00
|
|
|
for (ap = argv + 1; *ap != NULL; ap++) {
|
2007-10-30 02:20:37 +03:00
|
|
|
gp = ecalloc(1, sizeof(*gp));
|
1993-03-21 12:45:37 +03:00
|
|
|
gp->ge_name = vcopy(*ap);
|
|
|
|
gp->ge_link = gh->g_list;
|
|
|
|
gh->g_list = gp;
|
|
|
|
}
|
2006-03-03 16:36:27 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Delete the named group alias. Return zero if the group was
|
|
|
|
* successfully deleted, or -1 if there was no such group.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
delgroup(const char *name)
|
|
|
|
{
|
|
|
|
struct grouphead *gh, *p;
|
|
|
|
struct group *g;
|
|
|
|
int h;
|
|
|
|
|
|
|
|
h = hash(name);
|
|
|
|
for (gh = groups[h], p = NULL; gh != NULL; p = gh, gh = gh->g_link)
|
|
|
|
if (strcmp(gh->g_name, name) == 0) {
|
|
|
|
if (p == NULL)
|
|
|
|
groups[h] = gh->g_link;
|
|
|
|
else
|
|
|
|
p->g_link = gh->g_link;
|
|
|
|
while (gh->g_list != NULL) {
|
|
|
|
g = gh->g_list;
|
|
|
|
gh->g_list = g->ge_link;
|
|
|
|
free(g->ge_name);
|
|
|
|
free(g);
|
|
|
|
}
|
|
|
|
free(gh->g_name);
|
|
|
|
free(gh);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
* The unalias command takes a list of alises
|
|
|
|
* and discards the remembered groups of users.
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
|
|
|
unalias(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1997-10-19 09:02:57 +04:00
|
|
|
char **ap;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
for (ap = v; *ap != NULL; ap++)
|
|
|
|
(void)delgroup(*ap);
|
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The do nothing command for comments.
|
|
|
|
*/
|
|
|
|
/*ARGSUSED*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2006-10-22 01:37:20 +04:00
|
|
|
null(void *v __unused)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Change to another file. With no argument, print information about
|
|
|
|
* the current file.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
file(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1996-06-08 23:48:09 +04:00
|
|
|
char **argv = v;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2002-03-04 06:07:25 +03:00
|
|
|
if (argv[0] == NULL) {
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)newfileinfo(0);
|
1993-03-21 12:45:37 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (setfile(*argv) < 0)
|
|
|
|
return 1;
|
|
|
|
announce();
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Expand file names like echo
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
echo(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1996-06-08 23:48:09 +04:00
|
|
|
char **argv = v;
|
1997-10-19 09:02:57 +04:00
|
|
|
char **ap;
|
2005-07-19 05:38:38 +04:00
|
|
|
const char *cp;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2002-03-04 06:07:25 +03:00
|
|
|
for (ap = argv; *ap != NULL; ap++) {
|
1993-03-21 12:45:37 +03:00
|
|
|
cp = *ap;
|
2002-03-04 06:07:25 +03:00
|
|
|
if ((cp = expand(cp)) != NULL) {
|
1993-03-21 12:45:37 +03:00
|
|
|
if (ap != argv)
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)putchar(' ');
|
|
|
|
(void)printf("%s", cp);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
}
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)putchar('\n');
|
1993-03-21 12:45:37 +03:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
/*
|
|
|
|
* Routines to push and pop the condition code to support nested
|
|
|
|
* if/else/endif statements.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
push_cond(int c_cond)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
struct cond_stack_s *csp;
|
|
|
|
csp = emalloc(sizeof(*csp));
|
|
|
|
csp->c_cond = c_cond;
|
|
|
|
csp->c_next = cond_stack;
|
|
|
|
cond_stack = csp;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static int
|
|
|
|
pop_cond(void)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
int c_cond;
|
|
|
|
struct cond_stack_s *csp;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if ((csp = cond_stack) == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
c_cond = csp->c_cond;
|
|
|
|
cond_stack = csp->c_next;
|
|
|
|
free(csp);
|
2007-10-23 18:58:43 +04:00
|
|
|
return c_cond;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Conditional commands. These allow one to parameterize one's
|
|
|
|
* .mailrc and do some things if sending, others if receiving.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
static int
|
|
|
|
if_push(void)
|
|
|
|
{
|
|
|
|
push_cond(cond);
|
|
|
|
cond &= ~CELSE;
|
|
|
|
if ((cond & (CIF | CSKIP)) == (CIF | CSKIP)) {
|
|
|
|
cond |= CIGN;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
ifcmd(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1996-06-08 23:48:09 +04:00
|
|
|
char **argv = v;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
char *keyword = argv[0];
|
|
|
|
static const struct modetbl_s {
|
|
|
|
const char *m_name;
|
|
|
|
enum mailmode_e m_mode;
|
|
|
|
} modetbl[] = {
|
|
|
|
{ "receiving", mm_receiving },
|
|
|
|
{ "sending", mm_sending },
|
|
|
|
{ "headersonly", mm_hdrsonly },
|
|
|
|
{ NULL, 0 },
|
|
|
|
};
|
|
|
|
const struct modetbl_s *mtp;
|
|
|
|
|
|
|
|
if (if_push())
|
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
cond = CIF;
|
|
|
|
for (mtp = modetbl; mtp->m_name; mtp++)
|
|
|
|
if (strcasecmp(keyword, mtp->m_name) == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (mtp->m_name == NULL) {
|
|
|
|
cond = CNONE;
|
|
|
|
(void)printf("Unrecognized if-keyword: \"%s\"\n", keyword);
|
|
|
|
return 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (mtp->m_mode != mailmode)
|
|
|
|
cond |= CSKIP;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
PUBLIC int
|
|
|
|
ifdefcmd(void *v)
|
|
|
|
{
|
|
|
|
char **argv = v;
|
|
|
|
|
|
|
|
if (if_push())
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
cond = CIF;
|
|
|
|
if (value(argv[0]) == NULL)
|
|
|
|
cond |= CSKIP;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
PUBLIC int
|
|
|
|
ifndefcmd(void *v)
|
|
|
|
{
|
|
|
|
int rval;
|
|
|
|
rval = ifdefcmd(v);
|
|
|
|
cond ^= CSKIP;
|
|
|
|
return rval;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Implement 'else'. This is pretty simple -- we just
|
|
|
|
* flip over the conditional flag.
|
|
|
|
*/
|
2005-07-20 03:07:10 +04:00
|
|
|
/*ARGSUSED*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2006-10-22 01:37:20 +04:00
|
|
|
elsecmd(void *v __unused)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (cond_stack == NULL || (cond & (CIF | CELSE)) != CIF) {
|
|
|
|
(void)printf("\"else\" without matching \"if\"\n");
|
|
|
|
cond = CNONE;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if ((cond & CIGN) == 0) {
|
|
|
|
cond ^= CSKIP;
|
|
|
|
cond |= CELSE;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* End of if statement. Just set cond back to anything.
|
|
|
|
*/
|
2005-07-20 03:07:10 +04:00
|
|
|
/*ARGSUSED*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2006-10-22 01:37:20 +04:00
|
|
|
endifcmd(void *v __unused)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
if (cond_stack == NULL || (cond & CIF) != CIF) {
|
|
|
|
(void)printf("\"endif\" without matching \"if\"\n");
|
|
|
|
cond = CNONE;
|
|
|
|
return 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
cond = pop_cond();
|
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the list of alternate names.
|
|
|
|
*/
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
PUBLIC int
|
2002-03-02 17:59:35 +03:00
|
|
|
alternates(void *v)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
1996-06-08 23:48:09 +04:00
|
|
|
char **namelist = v;
|
2007-10-27 19:14:50 +04:00
|
|
|
size_t c;
|
1997-10-19 09:02:57 +04:00
|
|
|
char **ap, **ap2, *cp;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
c = argcount(namelist) + 1;
|
|
|
|
if (c == 1) {
|
|
|
|
if (altnames == 0)
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
for (ap = altnames; *ap; ap++)
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)printf("%s ", *ap);
|
|
|
|
(void)printf("\n");
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
if (altnames != 0)
|
2005-07-20 03:07:10 +04:00
|
|
|
free(altnames);
|
2007-10-27 19:14:50 +04:00
|
|
|
altnames = ecalloc(c, sizeof(char *));
|
1993-03-21 12:45:37 +03:00
|
|
|
for (ap = namelist, ap2 = altnames; *ap; ap++, ap2++) {
|
2007-10-27 19:14:50 +04:00
|
|
|
cp = ecalloc(strlen(*ap) + 1, sizeof(char));
|
2005-07-20 03:07:10 +04:00
|
|
|
(void)strcpy(cp, *ap);
|
1993-03-21 12:45:37 +03:00
|
|
|
*ap2 = cp;
|
|
|
|
}
|
|
|
|
*ap2 = 0;
|
From Anon Ymous:
1) Statification of modules.
2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.
3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.
4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).
5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)
6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.
7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).
8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).
9) Extend paging to all commands (where relevant).
10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.
11) The manpage should follow soon!!!!
2006-11-28 21:45:32 +03:00
|
|
|
return 0;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|