Commit Graph

259 Commits

Author SHA1 Message Date
wiz a6ce50109e Remove trailing whitespace. 2006-12-23 08:40:11 +00:00
christos 581e519fb5 From Anon Ymous:
1) When detaching, don't try to close things we shouldn't (after
   doing the header).  Specifically, mip->mi_head_end was not
   getting set correctly in mime_sendmessage().

2) Change paging to be closer to its old behavior: next, dt, and dp
   should only page if the crt variable is set; and don't automatically
   page most other commands - the user can always pipe them into more.
2006-12-15 20:26:03 +00:00
christos eea42e044a Fix timezone and date parsing. From Anon Ymous. 2006-12-10 06:06:47 +00:00
christos 8d6767f0e6 When "autoprint" and "crt" were set, the pager was getting bypassed.
Thanks to Patrick Klos for reporting the problem. (from Anon Ymous)
2006-12-06 17:55:00 +00:00
christos 6e70cbd24e From Anon Ymous:
Partially restore the "crt" variable: if set, the [pP]rint and [tT]ype
commands invoke the PAGER making them identical to the [pP]age and
[mM]more commands.  Its value is now ignored.  If anyone really
objects, I will do my best to restore the old behavior, but it really
doesn't fit very well into the current paging architecture.
2006-12-06 16:26:24 +00:00
christos 67e2fbb036 fix a core-dump and do some more error checking via asserts. From Anon Ymous 2006-12-05 03:47:41 +00:00
christos 1194ba0741 Document the new threading etc. features. From Anon Ymous. 2006-12-03 18:09:09 +00:00
christos 75df0a7821 block a few more signals, from anon 2006-11-29 01:29:46 +00:00
christos c77cd73835 don't block sigterm otherwise a forked process that sends a sigterm to itself
never exits (gv), from anon
2006-11-29 01:25:28 +00:00
christos 3a9442af4c pointers should be either casted to intptr_t or even better not casted... 2006-11-28 20:29:25 +00:00
christos f20e38f662 pass lint. 2006-11-28 18:46:04 +00:00
christos f309875081 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 18:45:32 +00:00
christos 1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00
christos 3bf60b1367 From Anon Ymous:
The problem is that mime_decode_close() closes all files registered
after mip->mi_pipe_end and this is getting set in mime_sendmessage()
after a fflush().

When you print a large number of messages fflush() blocks and prevents
mip->mi_pipe_end from getting set before the SIGPIPE comes in and
jumps to the close block that calls mime_decode_close().  As a result,
mime_decode_close() was closing all the registered files including
obuf (mi_pipe_end was NULL).
2006-11-01 16:42:27 +00:00
christos eb238f14b4 new file from Anon Ymous 2006-10-31 22:37:19 +00:00
christos f1830357a3 new files from Anon Ymous. 2006-10-31 22:36:37 +00:00
wiz c00bfebf76 Various fixes. Bump date for previous. 2006-10-31 22:10:41 +00:00
christos 798fbc606d More fixes from Anon Ymous:
1) Removed the -B flag (it was stupid on my part) and added a short
   description indicating how to accomplish the same thing under the
   "Sending Mail" section of man mail(1).

2) Added a -H flag to dump the headers and exit.  It takes optional
   flags to restrict to old, new, read, unread, and deleted messages
   (the later being kind of useless - it shares code with something
   that already had it).

3) Restored the 'Save' command which somehow got mistakenly removed in
   the last commit and add documentation for it!  (My apologies to
   its author.)

4) Added a 'mkread' command to mark messages as read (the inverse of
   'unread').  Should we also have a 'mknew' command?

5) Added a 'smopts' command to keep a database of addresses and
   sendmail options to be used when sending messages to those
   addresses.  See man mail(1) for a fuller description.

6) Added 'indentpreamble' and 'indentpostscript' variables whose
   values are inserted before and after a quoted message (~m or ~M
   escapes).
=20
7) Added string formatting abilities for the 'prompt', 'insertpreamble',
   'insertpostscript', and header display strings.  These strings
   support all the strftime() format parameters as well as many more
   specific to mail (see man mail(1)).

8) Fix the -a flag so that it only takes a single filename, unless
   "mime-attach-list" is defined.  This is more conventional and avoids
   unexpected whitespace issues.
2006-10-31 20:07:32 +00:00
wiz 7b2e399484 Some cleanups from the person without a name. 2006-10-26 15:26:37 +00:00
wiz 04f37109b9 New sentence, new line.
Use .Pp instead of .sp. Whitespace cleanup. Bump date for previous.
2006-10-26 11:05:29 +00:00
christos 933195ac45 more meaningful variable name. 2006-10-24 19:57:05 +00:00
christos f1aa39b33c deal with machines where char is unsigned and with chars > 127 2006-10-23 18:22:00 +00:00
mrg 478347642c avoid assigning a void * to an int just to see if it is non-zero or not.
use %zu to print a size_t.
2006-10-22 08:29:36 +00:00
mrg 1aa136c1a1 mail/head.c: make the previous delta only apply if FMT_PROG is not defined
fmt/Makefile: define FMT_PROG.
2006-10-22 08:22:34 +00:00
christos 1df0b9ba30 add ~@ 2006-10-22 00:35:29 +00:00
christos 5221554c1a Fix yes/no handling. 2006-10-21 21:51:47 +00:00
christos 8207b28a5c From our anonymous user:
- mime and character set handling
- command line editor and completion
- many code improvements
2006-10-21 21:37:20 +00:00
christos 5c86a088e8 Completion on a line like "." at the command prompt gives you a rather
rude response! (from our anonymous user)
2006-10-02 16:43:31 +00:00
christos f0f6b1cde9 Using (void)&foo; shuts up gcc-4 but does not stop the compiler from clobbering
the variables in the setjmp/longjmp cases. Use volatile instead as we are
supposed to (from our anonymous user).
2006-09-29 14:59:31 +00:00
christos 8d396aad54 Coverity CID 4194: Wow, isn't char *foo = bar() ? : "0"; a syntax error?!?! 2006-09-27 15:23:34 +00:00
christos 364b94acf5 Coverity CID 4195: Off by one buffer overflow. 2006-09-27 15:21:26 +00:00
christos 1a5929d3f3 Coverity CID 4196: Off by one buffer overflow. 2006-09-27 15:20:06 +00:00
christos 10c7dc6280 Avoid longjmp clobberring (from our anonymous user) 2006-09-27 12:58:33 +00:00
christos b10771897b handle signals for the second editline struct. (from our anonymous user) 2006-09-26 23:33:56 +00:00
christos 0dea4d56e9 add a continue message. 2006-09-26 23:33:23 +00:00
christos fbdddce8c7 1) Disable completion and history when grabbing header strings (e.g.,
with '~h' in the mail editor).
2) Eliminate a core dump when hitting '^D' with a zero length line.
From our anonymous user
2006-09-24 14:01:48 +00:00
wiz 1fe50328b8 Drop trailing whitespace. New sentence, new line.
Use .Dq.
2006-09-23 11:16:21 +00:00
he c364d22b20 The recently added -ledit needs -ltermcap added as well. 2006-09-20 09:29:42 +00:00
christos fccf00319f document the new options; from out anonymous user. 2006-09-20 01:25:16 +00:00
christos e7d816a1da s/ReplyFrom/ReplyAsRecipient/ from our anonymous user. 2006-09-19 20:31:49 +00:00
christos 630fdba88e add an el_ prefix to the libedit variables. From our anonymous user. 2006-09-19 18:52:04 +00:00
wiz 4357668fad Sort options. Remove duplicate word. Use more markup macros. 2006-09-19 18:52:02 +00:00
christos 3cd99db90e restore "sh" to mean "shell" not "show". From our anonymous user. 2006-09-19 18:01:00 +00:00
christos 43c9741202 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).
2006-09-18 19:48:44 +00:00
christos 85c81c58a5 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 19:46:21 +00:00
wiz 3c488ef896 It is sendmail(1), not sendmail(8). Prepare for HTML output.
Remove trailing space.
2006-08-23 21:02:29 +00:00
christos 0bdbda4753 mention that following the recipient(s) one can supply sendmail flags.
from our anonymous admirer.
2006-08-22 17:13:12 +00:00
ghen 3da129c2c7 Make mail(1) invoke "sendmail" instead of "send-mail", this is more standard.
Ok with christos.
2006-06-15 13:03:29 +00:00
christos 4871d79cb7 Coverity CID 3318: Remove stray semicolon that caused close to be called
unintentionally.
2006-05-24 15:53:21 +00:00
mrg c92f14aaa2 include "rcv.h" so that extern array types are well-known. 2006-05-11 10:45:48 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
christos ed5c178a35 Use errx instead of fprintf/fputs. 2006-05-01 23:12:24 +00:00
christos 9136a179f7 Coverity CID 1198: Avoid closing a negative fd. 2006-05-01 23:06:55 +00:00
christos 85576ae019 Coverity CID 1224: Avoid closing a negative fd. 2006-05-01 23:05:24 +00:00
christos 57e9a1d730 PR/32978: Johan Veenhuizen: mail(1) creates record file with insecure umask 2006-03-03 15:07:00 +00:00
christos 463f84da0a PR/32964: Johan Veenhuizen: implement the unalias command 2006-03-03 13:36:27 +00:00
christos ed70dac6b1 add more const 2006-01-05 02:13:41 +00:00
christos ca28631014 Pass lint completely. 2005-07-19 23:07:10 +00:00
christos ece0fd5c87 WARNS=3 2005-07-19 01:38:38 +00:00
wiz 077ec48387 Fix temp file paths. From Jeff Ito in PR 30316. 2005-05-24 11:21:40 +00:00
dsl 108eb2ab42 Add (unsigned char) cast to ctype functions 2004-10-30 20:39:35 +00:00
lukem ee04d88971 Consistently use CONFIGFILES & CONFIGLINKS (which enable the 'configinstall'
target) instead of using home-grown 'distribution' targets or using
FILES with the 'install' target.
Add some etc/ subdir Makefiles where appropriate.

XXX: some of etc/Makefile install-etc-files could be converted to CONFIGFILES.
2004-05-16 09:53:09 +00:00
ross 3d7196f4d4 Simplify set(). No functional change. 2003-11-10 21:40:22 +00:00
ross 714ccc9c51 Refix last delta's string copying edits 2003-11-10 21:37:36 +00:00
ross 405db788de Defensively rewrite a string moving loop.
Constify.
Check for an allocation error.
2003-10-31 01:25:54 +00:00
ross a1a806781b Fix the broken "!" escape and "shell" (&-prompt) commands. These problems
were related to closed PR bin/21896, and to the 2003-3-29 code import.
2003-10-29 05:11:26 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
christos ed5bfb0707 PR/21896: Jun-ichiro itojun Hagino: Fix botch with passing -1 as the stdin
for the editor instead of 0.
2003-07-14 20:49:14 +00:00
lukem 001c68bd94 Rename a large chunk of the make(1) variables which refer to a
program/tool from "FOO" to "TOOL_FOO".  The new variables are:
	TOOL_ASN1_COMPILE  TOOL_CAP_MKDB  TOOL_CAT  TOOL_CKSUM  TOOL_COMPILE_ET
	TOOL_CONFIG  TOOL_CRUNCHGEN  TOOL_CTAGS  TOOL_DB  TOOL_EQN  TOOL_FGEN
	TOOL_GENCAT  TOOL_GROFF  TOOL_HEXDUMP  TOOL_INDXBIB  TOOL_INSTALLBOOT
	TOOL_INSTALL_INFO  TOOL_M4  TOOL_MAKEFS  TOOL_MAKEINFO  TOOL_MAKEWHATIS
	TOOL_MDSETIMAGE  TOOL_MENUC  TOOL_MKCSMAPPER  TOOL_MKESDB
	TOOL_MKLOCALE  TOOL_MKMAGIC  TOOL_MKTEMP  TOOL_MSGC  TOOL_MTREE
	TOOL_PAX  TOOL_PIC  TOOL_PREPMKBOOTIMAGE  TOOL_PWD_MKDB  TOOL_REFER
	TOOL_ROFF_ASCII  TOOL_ROFF_DVI  TOOL_ROFF_HTML  TOOL_ROFF_PS
	TOOL_ROFF_RAW  TOOL_RPCGEN  TOOL_SOELIM  TOOL_SUNLABEL  TOOL_TBL
	TOOL_UUDECODE  TOOL_VGRIND  TOOL_ZIC

For each, provide default in <bsd.sys.mk> of the form:
	TOOL_FOO?=	foo
and for the ${USETOOLS}=="yes" case in <bsd.own.mk>, provide override:
	TOOL_FOO=	${TOOLDIR}/bin/${_TOOL_PREFIX}foo

Document all of these in bsd.README.

This cleans up a chunk of potential (and actual) namespace collision
within our build infrastructure, as well as improves consistency in
the share/mk documentation and provision of appropriate defaults for
each of these variables.
2003-07-10 10:33:58 +00:00
wiz 323aeda0d6 Fix quoting. 2003-06-26 16:48:20 +00:00
christos c1587f4d47 bring in fixes from OpenBSD:
- use varargs properly.
- pid_t
- better handling of error conditions on forked jobs.
2003-03-29 21:41:04 +00:00
perry 02b57cf8a2 Fix a bug introduced by Christos Zoulas in version 1.4.
He accidently moved the call to block the SIGCHLD to the wrong side of
the call to findchild().
Caused a coredump in one in every N thousand invocations of mail,
which I have been hunting for literally years.
Fixes PR 19696 from Mason Loring Bliss, too.

By the way, this is a prime example of why declarations of the form

struct foo *p = funcall();

are pure liquid evil.
2003-03-29 21:27:38 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
perry 8a49ec08e4 "Utilize" has exactly the same meaning as "use," but it is more
difficult to read and understand. Most manuals of English style
therefore say that you should use "use".
2003-02-04 23:07:28 +00:00
pooka 732f4c9fa5 Add ${MACROS} to ${ROFF} usage to make output readable
from jbernard@mines.edu in misc/19685
2003-01-05 12:24:22 +00:00
wiz 95882a7a34 Ispell. Begin new sentences on a new line. 2002-09-26 01:13:41 +00:00
itojun dbf388bc4f calloc() arg mistake. it's (nelem, size). from openbsd 2002-08-12 02:40:20 +00:00
ross ecb9aca3ae The print/Print pair just cries out for a corresponding save/Save feature,
so implement the "missing" Save command -- save all the headers.
2002-03-29 15:10:02 +00:00
ross 3038d491a5 only count header lines that are actually going to be displayed
when deciding whether to run $PAGER, otherwise it may start up the
pager for a two line message if all 55 header lines are the subject
of a .mailrc ignore command.

(And no, I don't find this program directly useful for reading
today's mail volumes, but it's great as a component run from wrapper
scripts, pretty good for scanning archived mail, and more than
adequate for sending mail.)
2002-03-29 15:07:52 +00:00
wiz c8ce18c2b7 Do not remove the spool file if not mail remains, just truncate it
to 0 bytes, as e.g. Solaris-mail or mutt do.
This way we're sure to keep owner/permissions the same as before.
Reviewed by Christos.
2002-03-12 01:17:46 +00:00
wiz 6e6e326518 Usually, one reads from standard input, not standard output (comment). 2002-03-08 02:05:25 +00:00
wiz 240d8221ea Replace last tempnam() with mkstemp(), and remove the tempMail variable.
Inspired by OpenBSD.
mail(1) is now tempnam(3) free.
2002-03-06 17:36:44 +00:00
wiz a3b751130f Give mail.1 a DESCRIPTION section.
Closes bin/14591.
2002-03-06 14:09:14 +00:00
wiz 443084c89d Replace another tempnam() with mkstemp(), and remove the tempEdit variable.
Inspired by OpenBSD.
2002-03-06 13:45:51 +00:00
wiz ae38aa875b Use warn() instead of perror(). 2002-03-05 21:29:30 +00:00
wiz b6e7b17180 KNF: No space after casts. 2002-03-05 21:18:14 +00:00
wiz 9c3d74c30b Replace another tempnam() with mkstemp(), and remove the tempResid variable.
Inspired by OpenBSD.
2002-03-05 21:11:46 +00:00
wiz d44726b8b5 Replace a 0-cast with NULL. 2002-03-05 20:58:54 +00:00
wiz 69047878cf Replace another tempnam with mkstemp (inspired by OpenBSD).
Replace perror with warn.
Use NULL instead of some cast 0.
s|/usr/mail|/var/mail| in a comment.
2002-03-05 20:57:28 +00:00
wiz afc1761e0b Replace another tempnam() with mkstemp(), and remove the tempMesg variable.
Inspired by OpenBSD.
2002-03-05 20:26:59 +00:00
wiz c3df89412e Replace printf+exit with errx. 2002-03-05 20:15:33 +00:00
wiz 4361c5156c Check tmpdir for being empty and remove trailing slashes in it. Replace one
tempnam() with mkstemp(), and remove the tempQuit variable.
Inspired by OpenBSD.
2002-03-05 20:14:02 +00:00
wiz a5643639a9 ANSIfy another function (overlooked that one...). 2002-03-05 19:26:42 +00:00
wiz ad41eb4f49 Use strpbrk(3) instead of anyof(). 2002-03-05 19:25:16 +00:00
wiz cb6786d45f Replace some more special pointers to zero (NIL, NONE, NOVAR, NOGRP, NOGE)
with NULL.
2002-03-04 03:16:10 +00:00
wiz ab85015570 Don't use special null string pointer (NOSTR), just use NULL. 2002-03-04 03:07:25 +00:00
wiz 76925748f3 WARNS=2. 2002-03-02 15:29:49 +00:00
wiz 4e972651c7 Rename variables to avoid shadowing. 2002-03-02 15:27:51 +00:00
wiz b127cccc2e ANSIfy, and minimal KNF. 2002-03-02 14:59:35 +00:00
wiz 024b462262 Rename a variable to avoid shadowing. 2002-03-02 14:00:26 +00:00