Commit Graph

276 Commits

Author SHA1 Message Date
christos a7879b44e9 make sure that signal handlers are always initialized. 2012-06-12 19:03:26 +00:00
christos 5942983d76 set close on exec for all opened files. 2012-04-29 23:50:22 +00:00
joerg cdaeb35ee5 Mark sasprintf as using a printf-like format. Fix format string to use
all arguments by telling the user what file would be overwritten.
2012-02-28 22:30:44 +00:00
christos 7f5fd4a5cd PR/45842: Henning Petersen: compare fgets with NULL not 0 2012-01-16 17:38:16 +00:00
joerg 6818646ac8 Use __dead 2011-09-16 15:39:25 +00:00
christos abf73dc18d document non-literal format string 2011-08-16 11:49:17 +00:00
joerg a5bcf1850f Use proper format strings. 2011-05-24 12:33:22 +00:00
dyoung c45c4e89a1 Rename sigqueue to sigq to avoid clashing with sigqueue(2). Now this
builds again.
2011-01-10 17:14:38 +00:00
njoly 1adf1b7dc0 Fix sub-section reference. 2010-12-23 20:11:00 +00:00
christos 02bc858973 - fix format print issue. from anon ymous 2010-06-21 19:49:31 +00:00
joerg 06ff5ce94c Explicitly quote |. Don't use .%T outside the scope of .Rs/.Re. 2010-05-14 16:23:42 +00:00
joerg 5180429ad8 Use \e 2010-03-21 13:34:34 +00:00
roy 98eb889579 Userland now builds and uses terminfo instead of termcap.
OK: core@, jdc@
2010-02-03 15:34:37 +00:00
christos d449716afd error message cleanup
- 1 -> EXIT_FAILURE
- fprintf(stderr, -> warnx(
- better warning messages
2010-01-12 14:45:31 +00:00
christos b8afdde726 - 1 -> EXIT_FAILURE
- avoid assertion firing when hitting ^D in CC: line.
2010-01-12 14:44:24 +00:00
christos 533d2abbab - 1 -> EXIT_FAILURE
- preallocate child struct, since the signal handler can be called before
  wait_child, and we cannot allocate a child struct there. there is a signal
  race still here if the program exits and the signal handler is called before
  we allocate the struct.
2010-01-12 14:43:31 +00:00
snj 550147bd6a Remove 3rd and 4th clauses in christos' license. OK christos. 2009-10-21 01:07:44 +00:00
christos 1ed23800b4 Don't barf on malformed mime messages (missing mime version). From Anon Ymous 2009-08-28 14:26:50 +00:00
apb 3ac228d1b2 Declare "com" as volatile in execute(), to make it safe to use
across setjmp/longjmp.

Inspired by PR 41255 from Kurt Lidl, but this change makes "com" a
volatile pointer to const non-volatile data, whereas the PR made it a
non-volatile pointer to const volatile data.
2009-07-14 21:15:48 +00:00
lukem c1ceae17f0 Enable WARNS=4 by default for usr.bin, except for:
awk  bdes  checknr  compile_et  error  gss  hxtool  kgetcred  kinit
	klist  ldd  less  lex  locale  login  m4  man  menuc  mk_cmds
	mklocale  msgc  openssl  rpcgen  rpcinfo  sdiff  spell  ssh
	string2key  telnet  tn3270  verify_krb5_conf  xlint
2009-04-14 22:15:16 +00:00
he ec30dc689c Do the -Wuninitialized workaround in a way which conforms to our
style guide, and remove a now unneeded LINTED comment.  From private
feedback.
2009-04-13 10:03:58 +00:00
he a389f78e47 Work around a problem with gcc -Wuninitialized seen for our sh3 targets. 2009-04-12 22:47:39 +00:00
christos 27b54bd918 - magic fix for short files
- knf
from Anon Ymous
2009-04-11 14:22:32 +00:00
christos ca13337dfe 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 13:08:24 +00:00
joerg 5d8c8ad0cf Fix quoting. 2009-03-23 17:02:06 +00:00
christos df68463076 fix warnings. 2009-03-11 01:10:05 +00:00
christos 71735a83f7 add missing , 2009-02-11 19:22:22 +00:00
christos 26114345a6 don't print warnings about can't find termcap entry. 2009-02-11 19:10:08 +00:00
lukem 1742612d3c sign-compare fix for amd64 2009-01-25 14:07:18 +00:00
lukem c172e3b989 fix -Wsign-compare issues 2009-01-18 01:29:57 +00:00
wiz be47919875 Spelling fixes. 2008-12-08 11:32:18 +00:00
christos c78e2d1227 PR/1880: Jim Barnard: Don't parse backslash escaped characters inside single
quoted strings.
2008-12-07 19:21:00 +00:00
christos c6f8f3a3b2 PR/1880: Jim Barnard: Pass backslash escaped characters unintepreted inside
single quoted strings. Document new behavior, and its relationship with POSIX.
2008-12-07 19:17:09 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
christos 17a5e23949 Make sure the current message (dot) is set correctly when changing the
display state, i.e., hidden/exposed tags or threads.  This fixes at
least two problems:

- If the current message is a duplicate that is deleted by the "deldups"
  command, then the dot was invalid making all messages appear to have
  been deleted.  It is now set to the surviving duplicate message.

- If the current message is tagged, the "hidetags" command would leave
  the dot invalid and the dislay would reset it at the top of the
  current screen.  It is now set the the first untagged (and
  not deleted) message after the previous (tagged) dot message.

From Anon Ymous
2008-04-27 22:26:50 +00:00
christos a2fe0ba0a1 Fix a header decode mistake that caused mime header lines decoded by
hfield() to be decoded as if they were "unstructured" regardless of
their type.  This resulted from calling mime_decode_hfield() with the
body of the header line, i.e., the portion after the colon header
field name terminator, rather than the full header line.
From Anon Ymous
2008-04-24 01:27:06 +00:00
christos 08face766e Fix a (very old) file leak. From Anon Ymous 2007-12-17 22:06:00 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
christos 428c7a1f82 From Anon Ymous:
- Fix a file handle leak.
- Use Fopen(), Fdopen(), and Fclose() consistently so the signal
  handler close files.
2007-12-14 16:55:20 +00:00
christos 7c16cc9e3b From Anon Ymous
- Fix a stupid typo: sizeof(sizeof(a)) isn't very useful.
- Use emalloc(3) and erealloc(3) instead of malloc(3) and realloc(3),
  resp.
2007-11-14 22:06:04 +00:00
christos fef32d862e From Anon Ymous: Make this compile without MIME_SUPPORT. 2007-10-30 16:08:11 +00:00
christos e988ecba95 bump date 2007-10-30 02:29:22 +00:00
christos 349d978117 From Anon Ymous:
- Add a "forward" command as requested by garbled@.
  From the manpage:

  forward
	  Takes a list of messages and prompts for an address (or
	  addresses) to forward each message to.  If no message list is
	  specified, the current message is used.  The mail editor is run
	  for each message allowing the user to enter a message that will
	  precede the forward message.  The message is sent as a multi-
	  part/mixed MIME encoded message.

- Add the ability to match messages that do (or do not) contain a
  header field.  E.g., the command "f ! /Subject:" will display the
  list of messages that are missing a "Subject" field.

- Teach savemail() to prefix fake headlines so the mbox doesn't get
  broken.

- Fixed a couple of "bugs" in the attachment editing routine.
2007-10-30 02:28:30 +00:00
christos 2283d346cb From Anon Ymous:
knf changes:
- s/sizeof x/sizeof(x)/.
- remove unnecessary malloc typecasts.
- whitespace nits.
2007-10-29 23:20:37 +00:00
christos 4556f89a2d From Anon Ymous:
- Add a "bounce" command as requested by garbled@.
  From the manpage:

 bounce  Takes a list of messages and prompts for an address to bounce the
         messages to.  All the original header fields are preserved except
         for the ``Delivered-To'', ``X-Original-To'' and ``Status''
         fields.  The new ``To'' field contains the bounce address(es)
         plus any addresses in the old ``To'' field minus the user's local
         address and any on the alternates list.  (See the alternates com-
         mand.)
2007-10-27 15:14:50 +00:00
christos d727506fb5 From Anon Ymous:
- Introduce date_to_tm() and hl_date_to_tm() to parse the date and
  headline date a bit more efficiently.
- If 'tm_isdst' is determined, let strftime(3) handle the '%Z' and
  '%z' formats.  Otherwise, output "-0000" and "???", respectively, to
  help preserve with alignment; strftime(3) will output an empty
  string in these case.
- Change fail() to use the '-d' flag (which sets the 'debug' variable)
  rather than the "debug" _environment_ variable.  This is more
  consistent with other warnings.
- Don't use gcc C extensions, e.g., "case LOW ... HIGH:".
- Define is_WSP() in def.h to be an inline function that for checks
  whitespace (WSP = ' ' or '\t'), as defined in RFC 2822.  Use it
  consistently in place of isblank().
- For consistency, rename skip_blank() to skip_WSP().
- Add inline skip_space() to complement skip_blank() (now skip_WSP).
- Check all ctype(3) calls for argument range issues.
- Whitespace and comment cleanup/changes.
2007-10-23 14:58:43 +00:00
christos 3e94d8f384 Handle 2 digit years, from Anon Ymous 2007-10-19 15:59:55 +00:00
christos 790ed387b2 Use warnx(3) not warn(3); timegm(3) does not set errno. Use the
unconverted time if the date is invalid. (from Anon Ymous)
2007-10-04 17:05:01 +00:00
christos ecde76d5ff Support obsolete zone info in date field. (See obs_zone of RFC 2822,
sec 4.3.) from Anon Ymous
2007-09-12 13:09:46 +00:00