]> diplodocus.org Git - nmh/log
nmh
8 years agocppflags.m4: Don't trample CFLAGS and CPPFLAGS.
Ralph Corderoy [Sun, 20 Aug 2017 13:16:09 +0000 (14:16 +0100)]
cppflags.m4: Don't trample CFLAGS and CPPFLAGS.

They were always being restored, but not necessarily saved first.  There
might still be some odd behaviour in this area.  I'm seeing -D...
preprocessor symbols disappear on subsequent runs causing compilation
problems, e.g. strcasecmp(3) not prototyped.

8 years agoAdd -D_FORTIFY_SOURCE=2 to CPPFLAGS instead of AM_CPPFLAGS.
David Levine [Sun, 20 Aug 2017 13:20:49 +0000 (09:20 -0400)]
Add -D_FORTIFY_SOURCE=2 to CPPFLAGS instead of AM_CPPFLAGS.

To make it easier for packagers to override.
Fix to commit 35d2b4dc00d705e6816bcb0ccab491aabda688dc.

8 years agoRestored old NAME in mhical(1) man page.
David Levine [Sun, 20 Aug 2017 12:50:17 +0000 (08:50 -0400)]
Restored old NAME in mhical(1) man page.

mhical only operates on iCalendar event requests, not messages.
Fix to commit 0e7daaa2daf6c668c8c6feb9da3c9a6639fa4e7e.

8 years agoscan.man: Note that %{body} does not decode MIME.
Ralph Corderoy [Sun, 20 Aug 2017 11:33:38 +0000 (12:33 +0100)]
scan.man: Note that %{body} does not decode MIME.

8 years agosbr/mf.c: Simplify logic, ditching endless for-loops and switch.
Ralph Corderoy [Sun, 20 Aug 2017 11:20:45 +0000 (12:20 +0100)]
sbr/mf.c: Simplify logic, ditching endless for-loops and switch.

Some of the control flow follows the pattern of the larger sections: an
endless for-loop with a switch, and then cases that continue or break,
and another break out of the for loop.  For the simpler cases, it's much
easier to read a simple while-loop that achieves the same in fewer
lines.  No functional change intended.

8 years agosbr/mf.c: Remove QUOTE macro, use its '\\' definition instead.
Ralph Corderoy [Sun, 20 Aug 2017 10:56:55 +0000 (11:56 +0100)]
sbr/mf.c: Remove QUOTE macro, use its '\\' definition instead.

The name suggests a quote character, not the backslash as an escape
character that quotes what comes after it.  It's easier to read '\\' and
instantly know what's meant.

8 years agocontains8bit(): Don't fetch a byte when start >= end.
Ralph Corderoy [Sun, 20 Aug 2017 10:38:04 +0000 (11:38 +0100)]
contains8bit(): Don't fetch a byte when start >= end.

The test for a NUL byte was before the test for start being before end.
Whilst here, hoist the test of end out of the per-byte loop, alter the
function to return bool, and merge the two, different, comments
explaining the function's behaviour.

8 years agoNEWS: Add bug fix: EPIPE when writing error no longer recurses.
Ralph Corderoy [Sun, 20 Aug 2017 09:34:01 +0000 (10:34 +0100)]
NEWS: Add bug fix: EPIPE when writing error no longer recurses.

Also move an existing item into the Bug Fixes section.

8 years agoNEWS: Consistent punctuation. Mention SI and IEC quantities.
Ralph Corderoy [Sun, 20 Aug 2017 08:31:18 +0000 (09:31 +0100)]
NEWS: Consistent punctuation.  Mention SI and IEC quantities.

8 years agotest-sendfiles: Feed `lzma -cd' stdin rather than a filename.
Ralph Corderoy [Sat, 19 Aug 2017 14:58:49 +0000 (15:58 +0100)]
test-sendfiles: Feed `lzma -cd' stdin rather than a filename.

HÃ¥kon Alstadheim reported that Debian's lzma-9.22-2 would complain at
`lzma -cd foo.tar' with `unknown suffix -- unchanged' even though it was
not being asked to alter the file, or produce a new one based on its
filename.  This appears to be https://bugs.debian.org/700681.  The lzma
from Arch Linux's xz 5.2.3-1 does no have this fault.  Work around it by
feeding the file to decompress on standard input for all the compression
programs being tested;  none of the others should mind.

8 years agoProtect fileno() call against NULL argument.
David Levine [Sat, 19 Aug 2017 03:18:15 +0000 (23:18 -0400)]
Protect fileno() call against NULL argument.

Fix to commit 337b4e616e8f53ba06285b1645e1df9918ed5c16.  Thanks to
Norm for reporting and Ken for diagnosing the bug.

8 years agolock_file.c: Compiler warns of unused isnewlock if HAVE_LIBLOCKFILE.
Ralph Corderoy [Fri, 18 Aug 2017 13:29:59 +0000 (14:29 +0100)]
lock_file.c: Compiler warns of unused isnewlock if HAVE_LIBLOCKFILE.

8 years agoDefault CFLAGS to -std=c99 instead of -ansi.
David Levine [Thu, 17 Aug 2017 23:45:20 +0000 (19:45 -0400)]
Default CFLAGS to -std=c99 instead of -ansi.

gcc -ansi -pedantic issued a few warnings about C90 not supporting the
"ll" printf length modifier.  Ralph pointed out that
http://www.unix.org/version4/overview.html says:

    The following source code portability standards lie at the core of
    the Single UNIX Specification:

        POSIX.1-2008

    (This is technically identical to the Base Specifications, Issue 7;
    they are one and the same document.)

        The ISO/IEC 9899:1999 standard

So perhaps we're wrong to expect modern POSIX code to compile as C90.

8 years agomhical expected an ics file as input and after just pressing
Leonardo Taccari [Thu, 17 Aug 2017 23:42:48 +0000 (19:42 -0400)]
mhical expected an ics file as input and after just pressing
^D I've found that mhical wasn't happy about an empty input.
A trivial patch that should fix this issue.

8 years agoBoth f_typestr(): Remove parenthesis from long list of returns.
Ralph Corderoy [Thu, 17 Aug 2017 11:42:57 +0000 (12:42 +0100)]
Both f_typestr(): Remove parenthesis from long list of returns.

It's not a function call, they're just noise.

8 years agoBoth f_typestr(): Rebuild switch from FT_* to string from scratch.
Ralph Corderoy [Thu, 17 Aug 2017 11:36:50 +0000 (12:36 +0100)]
Both f_typestr(): Rebuild switch from FT_* to string from scratch.

Adds missing cases, e.g. FT_LS_CFIND.  Removes inconsistent "FT_" prefix
from some strings, e.g. FT_LS_DECODE.  Re-orders cases to match
definitions.

8 years agofmtdump.c, fmttest.c: Remove tests for FT_LIT_FORCE.
Ralph Corderoy [Thu, 17 Aug 2017 11:20:16 +0000 (12:20 +0100)]
fmtdump.c, fmttest.c: Remove tests for FT_LIT_FORCE.

It isn't defined, and git-grep(1) suggests it was a local Lawrence
Berkeley Laboratory modification that output a literal without consuming
any of the width budget.

8 years agoMakefile.am: Remove `test -d' guarding `mkdir -p'.
Ralph Corderoy [Thu, 17 Aug 2017 11:09:43 +0000 (12:09 +0100)]
Makefile.am: Remove `test -d' guarding `mkdir -p'.

8 years agoMakefile.am: Remove multiple `mkdir -p' for etc; use ./configure.
Ralph Corderoy [Thu, 17 Aug 2017 10:59:38 +0000 (11:59 +0100)]
Makefile.am: Remove multiple `mkdir -p' for etc;  use ./configure.

A `mkdir -p' was used in each rule that created a file in etc to ensure
the directory already existed.  Ken pointed out existing ./configure
code to do that for the man directory, just once.  Use that for etc too.
Remove the `test -d' because `mkdir -p' does that itself.

8 years agocpnumber(): Cast desired width to size_t to silence gcc's warning.
Ralph Corderoy [Thu, 17 Aug 2017 10:35:51 +0000 (11:35 +0100)]
cpnumber(): Cast desired width to size_t to silence gcc's warning.

Add a comment on `wid = -wid' that it's OK because wid's value was
originally a short so won't remain the same value.

8 years agoFix bug in cpnumber().
Ken Hornstein [Thu, 17 Aug 2017 05:24:08 +0000 (01:24 -0400)]
Fix bug in cpnumber().

The cpnumber() function (which handles the NUMF instruction, among others)
would hang if a 0 width was given to it.  Make sure that (and negative
widths) are handled correctly.  Note that normally NUMF did not handle
left padding which is indicated by a negative width; that may change
in the future.

8 years agoImprove installation documentation
Ken Hornstein [Thu, 17 Aug 2017 05:12:22 +0000 (01:12 -0400)]
Improve installation documentation

Fix up the various installation information so it matches reality.

8 years agoMake sure the %(kilo) and %(kibi) instructions are in fmttest(1).
Ken Hornstein [Thu, 17 Aug 2017 03:55:23 +0000 (23:55 -0400)]
Make sure the %(kilo) and %(kibi) instructions are in fmttest(1).

Man, we should really merge fmttest and fmtdump at some point.

8 years agoINSTALL: Update c89(1) mention to c99(1), that exists today.
Ralph Corderoy [Wed, 16 Aug 2017 12:44:32 +0000 (13:44 +0100)]
INSTALL: Update c89(1) mention to c99(1), that exists today.

8 years agogetcwidth.c: Use WCHAR_MAX, not __WCHAR_MAX__.
Ralph Corderoy [Tue, 15 Aug 2017 23:49:02 +0000 (00:49 +0100)]
getcwidth.c: Use WCHAR_MAX, not __WCHAR_MAX__.

Former is clearly part of POSIX.

8 years agoinc.c: Use closure for pop_retr()'s action callback.
Ralph Corderoy [Sun, 13 Aug 2017 23:52:57 +0000 (00:52 +0100)]
inc.c: Use closure for pop_retr()'s action callback.

Allows file-static variables to become local to a function.  In fact,
two of them no longer need to exist:  one of them becomes the closure's
struct's member, and the other is always 0 and probably just present due
to copy and paste.

8 years agoinc.c: Alter pop_action() to check I/O, perhaps returning NOTOK.
Ralph Corderoy [Sun, 13 Aug 2017 17:07:33 +0000 (18:07 +0100)]
inc.c: Alter pop_action() to check I/O, perhaps returning NOTOK.

8 years agopopsbr.c: Alter traverse() to check action callback's result.
Ralph Corderoy [Sun, 13 Aug 2017 16:54:59 +0000 (17:54 +0100)]
popsbr.c: Alter traverse() to check action callback's result.

The action callback returned zero, with a 1999 comment asking if it was
checked.  traverse() didn't check it.  Change it so it does, wanting
`OK' if all's well, else returning the non-OK value to traverse's
caller;  though that only checks for NOTOK.  No functional change
intended.

8 years agopop_retr(): Add a `void *closure' to be passed to action callback.
Ralph Corderoy [Sun, 13 Aug 2017 16:13:34 +0000 (17:13 +0100)]
pop_retr(): Add a `void *closure' to be passed to action callback.

Only caller passes in NULL for the moment, and doesn't use it in the
callback, but it will allow fewer scopes by name of the variables the
action callback uses.

8 years agoinc.c: Narrow scope of inc_type. Chain mutually-exclusive ifs.
Ralph Corderoy [Sun, 13 Aug 2017 15:58:14 +0000 (16:58 +0100)]
inc.c: Narrow scope of inc_type.  Chain mutually-exclusive ifs.

Joining the separate if-statements with `else' tells the reader it's not
expected that more than one branch can be taken.  Useful when each is
many lines long.  No functional change intended.

8 years agoscan(): Don't ioctl(2) for TTY's width every call.
Ralph Corderoy [Sun, 13 Aug 2017 15:33:06 +0000 (16:33 +0100)]
scan(): Don't ioctl(2) for TTY's width every call.

Saves a system call per message scanned.  Does mean it won't adjust
should the terminal width change mid scan, but that seems fine;  after
all, the retrieved width could be out of date by the time a message's
output is written anyway.

8 years agom_getfld() et al: Replace with m_getfld2(), etc., in many places.
Ralph Corderoy [Sun, 13 Aug 2017 14:20:14 +0000 (15:20 +0100)]
m_getfld() et al: Replace with m_getfld2(), etc., in many places.

The difference is the FILE pointer isn't passed in on each call.
Instead, it's stored in the m_getfld_state_t once, on
m_getfld_state_init().  No functional change intended.

8 years agopost.man: Detail -port's default value: submission, 587.
Ralph Corderoy [Sun, 13 Aug 2017 14:04:58 +0000 (15:04 +0100)]
post.man: Detail -port's default value: submission, 587.

8 years agomhmisc.c: Indent with "%*s" rather than "%*.*s".
Ralph Corderoy [Fri, 11 Aug 2017 15:54:31 +0000 (16:54 +0100)]
mhmisc.c: Indent with "%*s" rather than "%*.*s".

No functional change intended, but it does silence one of gcc's warnings
given severe enough options.

8 years agomhparse.c: Cast ptrdiff_t from subtraction to long.
Ralph Corderoy [Fri, 11 Aug 2017 14:34:41 +0000 (15:34 +0100)]
mhparse.c: Cast ptrdiff_t from subtraction to long.

Cygwin's 32-bit doesn't like `%ld' for the `p - q' difference between
two pointers as the value is an int, not a long.  printf(3)'s `t' length
modifier, for ptrdiff_t, can't be used as that's C99, and we're C90.
Cast the difference to a long explicitly instead.

8 years agom_getfld() et al: Add wrapper without FILE *iob parameter.
Ralph Corderoy [Thu, 10 Aug 2017 14:44:20 +0000 (15:44 +0100)]
m_getfld() et al: Add wrapper without FILE *iob parameter.

m_getfld(), m_getfld_track_filepos(), and m_unknown() all take a FILE
*iob that's used to update *m_getfld_state_t, even though it's probably,
hopefully, the same as the previous calls.  Create wrapper functions for
these with an arbitrary `2' suffix that don't have this parameter.
After checking the m_getfld_state_t is initialised, they pass in its
existing FILE *iob.  This allows callers to transition to the wrappers
in the cases where it's obviously the same FILE *iob being passed in.
It isn't always obvious, in part because of the convention for calling
this variable `in', even when it's a file-level static, a word that also
occurs in comments.

8 years agom_getfld.c: Make m_getfld_state_init() public.
Ralph Corderoy [Thu, 10 Aug 2017 14:30:54 +0000 (15:30 +0100)]
m_getfld.c: Make m_getfld_state_init() public.

This allows callers to use it if they wish to pass in its FILE *iob.

8 years agom_getfld.c: Alter Peek() to call Getc() and Ungetc().
Ralph Corderoy [Wed, 9 Aug 2017 23:08:55 +0000 (00:08 +0100)]
m_getfld.c: Alter Peek() to call Getc() and Ungetc().

Functionally equivalent, not called too often, and it gets rid of
another copy of the logic to decide if we've enough, should read some
more, etc.

8 years agom_getfld.c: Alter Peek() to match Getc()'s structure.
Ralph Corderoy [Wed, 9 Aug 2017 22:56:27 +0000 (23:56 +0100)]
m_getfld.c: Alter Peek() to match Getc()'s structure.

Their logic was equivalent, but written differently, which didn't help
the reader easily see they were the same apart from whether the returned
character was consumed.  Now they're visually similar too.

8 years agom_getfld.c: Use intmax_t and PRIdMAX to printf off_t values.
Ralph Corderoy [Wed, 9 Aug 2017 18:46:26 +0000 (19:46 +0100)]
m_getfld.c: Use intmax_t and PRIdMAX to printf off_t values.

Compiling for ISO C90 prohibits casting to long long and printing with
"%lld", and printing as "%ld" is wrong on Mac OS where David reports
off_t is long long.

8 years agoleave_getfld(): Don't follow fseeko(SEEK_SET) with ftello().
Ralph Corderoy [Wed, 9 Aug 2017 16:03:24 +0000 (17:03 +0100)]
leave_getfld(): Don't follow fseeko(SEEK_SET) with ftello().

If fseeko(3) didn't error then we know the stream's position and the
ftello(3) is not needed.  Set last_caller_pos to total_bytes_read
instead.  This small change is a commit to help future bisecting.

8 years agotest/getcwidth.c: Allow for 8-bit and 16-bit wchar_t.
Ralph Corderoy [Wed, 9 Aug 2017 15:28:26 +0000 (16:28 +0100)]
test/getcwidth.c: Allow for 8-bit and 16-bit wchar_t.

David found Cygwin has a 16-bit wchar_t, and gcc's -fshort-wchar will
allow it to be altered on platforms where it would normally be 32 bit.

8 years agofmtdump.c: Add string for FT_LS_UNQUOTE case.
Ralph Corderoy [Wed, 9 Aug 2017 15:00:17 +0000 (16:00 +0100)]
fmtdump.c: Add string for FT_LS_UNQUOTE case.

It was missing since e8635a8a1 and the default case that attempted to
format it as a number was faulty, fixed in 39ecf70bb.  That fix broke
test/format/test-fmtdump as it expected the broken "blank line" to be
output instead.

8 years agoSilence more gcc format-string warnings.
Ralph Corderoy [Wed, 9 Aug 2017 14:42:48 +0000 (15:42 +0100)]
Silence more gcc format-string warnings.

By enabling more checks, gcc has found some real bugs, e.g. `printf(buf,
"%d", i)'.  Other changes required duplicating the formatting call with
a constant format string;  a local macro was used to avoid repeating all
the many arguments.

8 years agomhparse.c: Use constant indent for second line of messages.
Ralph Corderoy [Wed, 9 Aug 2017 14:06:01 +0000 (15:06 +0100)]
mhparse.c: Use constant indent for second line of messages.

It was using knowledge of inform()'s workings to indent by the varying
width of global invo_name plus two for the following ": ".  This also
cluttered every call's parameters with a strlen(), cast to an int for
printf's width specifier, and an empty string.  All noise for little
gain.

8 years agom_getfld.c: Alter Ungetc() to die if it can't rewind.
Ralph Corderoy [Wed, 9 Aug 2017 13:49:53 +0000 (14:49 +0100)]
m_getfld.c: Alter Ungetc() to die if it can't rewind.

It used to return EOF to the caller in this case, but none of the three
callers bothered checking.  And the other return value of a `peek' of
the character that would next be read was also unused.

8 years agom_getfld.c: Remove Ungetc()'s `c' parameter.
Ralph Corderoy [Wed, 9 Aug 2017 13:43:21 +0000 (14:43 +0100)]
m_getfld.c: Remove Ungetc()'s `c' parameter.

It's never used to unget a different character than what was just read,
making the function more of a `rewind'.

8 years agoTeach gcc(1) that adios() and friends take printf formats.
Ralph Corderoy [Wed, 9 Aug 2017 13:32:29 +0000 (14:32 +0100)]
Teach gcc(1) that adios() and friends take printf formats.

It then checks their arguments.  Correct the resulting warnings, e.g.
C89 doesn't have `%zu', but does say size_t shouldn't be wider than
long.  Perhaps an autoconf test can detect if the `format' __attribute__
is supported.

8 years agom_getfld.c: Check ftello(3) and fseeko(3) for errors.
Ralph Corderoy [Wed, 9 Aug 2017 12:50:31 +0000 (13:50 +0100)]
m_getfld.c: Check ftello(3) and fseeko(3) for errors.

They were being ignored.  Exit on failure;  harsh, but we don't know the
circumstances where they might occur and thus what recovery would be
apt.

8 years agostruct m_getfld_state: Re-order members in more top-down order.
Ralph Corderoy [Wed, 9 Aug 2017 12:33:09 +0000 (13:33 +0100)]
struct m_getfld_state: Re-order members in more top-down order.

Makes understanding its content easier.

8 years agom_getfld() and friends: Add commentary.
Ralph Corderoy [Wed, 9 Aug 2017 12:20:32 +0000 (13:20 +0100)]
m_getfld() and friends: Add commentary.

Possibly incorrect commentary, as all comments tend towards over time,
but better than nothing at the moment.  No functional change intended.

8 years agoFixed scan to handle empty files without violating an assert [Bug #51693].
David Levine [Wed, 9 Aug 2017 00:10:49 +0000 (20:10 -0400)]
Fixed scan to handle empty files without violating an assert [Bug #51693].

8 years agocpstripped(): Rewrite multi-byte version.
Ralph Corderoy [Sun, 6 Aug 2017 17:15:41 +0000 (18:15 +0100)]
cpstripped(): Rewrite multi-byte version.

Removes the assert(3) failure reported on the list for 1.7-RC1 when a
non-space, non-cntrl, rune has a wcwidth(3) of -1; output L'?' in its
place.  The old code also didn't reset mbtowc(3)'s state before trying
to parse "?";  that's handled differently now so isn't an issue.  Pad
with the multi-byte encoding of L" ", having ensured the wcwidth(1) of
L' ' is one, rather than with a non-wchar_t ' '.  Point out padding only
occurs in one particular case, and not the other two;  quite odd.

8 years agocpstripped(), single-byte: Simplify logic.
Ralph Corderoy [Sat, 5 Aug 2017 17:20:07 +0000 (18:20 +0100)]
cpstripped(), single-byte: Simplify logic.

Now that it doesn't have to fit in with the multi-byte version's logic,
it can be re-structured to be simpler.  No functional change intended.

8 years agocpstripped: Split into two versions, each with a single #ifdef.
Ralph Corderoy [Sat, 5 Aug 2017 16:57:48 +0000 (17:57 +0100)]
cpstripped: Split into two versions, each with a single #ifdef.

Got fed up trying to read C logic when the preprocessor's logic didn't
nest neatly with the function's.  No intentional change to either
version.

8 years agotest/getcwidth: Add --ctype to dump locale's iswprint(), etc.
Ralph Corderoy [Sat, 5 Aug 2017 16:16:39 +0000 (17:16 +0100)]
test/getcwidth: Add --ctype to dump locale's iswprint(), etc.

Didn't bother trying to `start - end' range the output.
Most of the time I want to slice and dice the output, or grep for a
particular value.  If I want ranges then I can post-process.

8 years agotest/getcwidth: Expand --dump beyond Unicode's BMP.
Ralph Corderoy [Sat, 5 Aug 2017 15:23:10 +0000 (16:23 +0100)]
test/getcwidth: Expand --dump beyond Unicode's BMP.

8 years agoNEWS: Move "new features" that might bite a user to the top.
Ralph Corderoy [Thu, 3 Aug 2017 11:22:07 +0000 (12:22 +0100)]
NEWS: Move "new features" that might bite a user to the top.

(cherry picked from commit 42455309a086a9ebbf55198dca5bab52e96ace84)

8 years agoNEWS: Re-order 1.7's sections, as discussed on nmh-workers.
Ralph Corderoy [Thu, 3 Aug 2017 11:17:30 +0000 (12:17 +0100)]
NEWS: Re-order 1.7's sections, as discussed on nmh-workers.

(cherry picked from commit bd39db60858810e0a268ddb5f18ed8879817790b)

8 years agoCleared pending-release-notes for the next release.
Ken Hornstein [Thu, 3 Aug 2017 02:22:22 +0000 (22:22 -0400)]
Cleared pending-release-notes for the next release.

8 years agoUpdates for 1.7 release.
Ken Hornstein [Thu, 3 Aug 2017 02:20:46 +0000 (22:20 -0400)]
Updates for 1.7 release.

(cherry picked from commit 5f39a8e67f4652752dd1b51726fe3a19dc4d5743)

8 years agoUpdate for new branch
Ken Hornstein [Wed, 2 Aug 2017 04:01:39 +0000 (00:01 -0400)]
Update for new branch

8 years agoUse correct error code for SSL context retrieval.
Ken Hornstein [Wed, 2 Aug 2017 03:53:05 +0000 (23:53 -0400)]
Use correct error code for SSL context retrieval.

Make sure we use the correct error code if we are unable to retrieve
the SSL context from the context from the BIO.

8 years agoDocument bug fix
Ken Hornstein [Tue, 1 Aug 2017 17:28:04 +0000 (13:28 -0400)]
Document bug fix

8 years agoMerge branch 'fix-post-bcc'
Ken Hornstein [Tue, 1 Aug 2017 17:22:36 +0000 (13:22 -0400)]
Merge branch 'fix-post-bcc'

This branch fixes bug #51098; the lack of alias expansion on a From line
when doing a Bcc.  Admittedly, this is rather an obscure bug, and AFAICT
it never worked in any version of MH or nmh, but it is fixed now.

8 years agoImplemented test for this patch.
Ken Hornstein [Tue, 1 Aug 2017 17:21:21 +0000 (13:21 -0400)]
Implemented test for this patch.

This patch tests the code that does alias expansion in a From line when
doing bcc.  Which is, now that I think about it, one heck of a corner case.

8 years agoMove m_getfld's MS_* mbox-type macros to the only user.
Ralph Corderoy [Tue, 1 Aug 2017 13:41:20 +0000 (14:41 +0100)]
Move m_getfld's MS_* mbox-type macros to the only user.

8 years agoRestricted application of the adjustment in m_Eom().
David Levine [Tue, 1 Aug 2017 02:00:39 +0000 (22:00 -0400)]
Restricted application of the adjustment in m_Eom().

Per Ralph's suggestion.  Update to commit 29db9a64a.  Also,
consolidated print statments in test-eom-align.

8 years agoHacked m_Eom() to fix test-eom-align.
David Levine [Mon, 31 Jul 2017 00:24:34 +0000 (20:24 -0400)]
Hacked m_Eom() to fix test-eom-align.

8 years agoRestored local variable to m_Eom(), to not truncate EOF.
David Levine [Sat, 29 Jul 2017 21:55:25 +0000 (17:55 -0400)]
Restored local variable to m_Eom(), to not truncate EOF.

Reversion of significant part of commit d3e11c5e9.  Thanks to Ralph
for noticing that it wasn't a good change.

8 years agoRemoved a local variable from m_Eom().
David Levine [Sat, 29 Jul 2017 21:07:06 +0000 (17:07 -0400)]
Removed a local variable from m_Eom().

Minor code simplification in preparation for upcoming fix.

8 years agoSimplified m_strn() per Ralph's suggestions.
David Levine [Sat, 29 Jul 2017 16:42:35 +0000 (12:42 -0400)]
Simplified m_strn() per Ralph's suggestions.

Update to commit 4a56a28ac.

8 years agoUse m_strn() to allow restoration of buffer size to 26 bytes.
David Levine [Sat, 29 Jul 2017 14:47:16 +0000 (10:47 -0400)]
Use m_strn() to allow restoration of buffer size to 26 bytes.

Fix to commit a3724ed39.

8 years agodtimezone(): Explain abs(3) is undefined on INT_MIN.
Ralph Corderoy [Sat, 29 Jul 2017 14:06:11 +0000 (15:06 +0100)]
dtimezone(): Explain abs(3) is undefined on INT_MIN.

That's why a negative int is flipped over into unsigned by assuming
two's complement.

8 years agoAdded m_str() and m_strn() functions to convert int to string.
David Levine [Sat, 29 Jul 2017 14:02:28 +0000 (10:02 -0400)]
Added m_str() and m_strn() functions to convert int to string.

Allows better fix to uip/forw.c than commit d711510305.

8 years agoSimplify dtimezone()'s logic by working with unsigned int.
Ralph Corderoy [Sat, 29 Jul 2017 13:29:15 +0000 (14:29 +0100)]
Simplify dtimezone()'s logic by working with unsigned int.

Character buffer is resized down from arbitrary 64 to suit 32-bit int,
a change to the recent a3724ed3.

8 years agoFinished implementation, but tests need to be written.
Ken Hornstein [Tue, 25 Jul 2017 19:40:28 +0000 (15:40 -0400)]
Finished implementation, but tests need to be written.

8 years agoAdded some specific tests to test-eom-align.
David Levine [Sun, 23 Jul 2017 15:39:24 +0000 (11:39 -0400)]
Added some specific tests to test-eom-align.

These were found by scanning a much larger range of buffer sizes,
over nmh versions from cvs, 1.4, 1.5, 1.6, and current HEAD.

8 years agoBump up size of two static char[] so gcc knows they won't overflow.
Ralph Corderoy [Mon, 17 Jul 2017 11:58:38 +0000 (12:58 +0100)]
Bump up size of two static char[] so gcc knows they won't overflow.

8 years agoIncrease size of buffer to avoid warning from gcc -Wformat-truncation.
David Levine [Mon, 17 Jul 2017 00:06:01 +0000 (20:06 -0400)]
Increase size of buffer to avoid warning from gcc -Wformat-truncation.

8 years agoReplaced snprintf() to convert an int with m_name().
David Levine [Sun, 16 Jul 2017 21:25:51 +0000 (17:25 -0400)]
Replaced snprintf() to convert an int with m_name().

At Ralph's suggestion.  The goal was to get rid of a warning from
gcc -Wformat-truncation, but the code ends up being cleaner as well.

8 years agoEnhanced mhical syntax error message to provide some context.
David Levine [Sun, 16 Jul 2017 13:02:08 +0000 (09:02 -0400)]
Enhanced mhical syntax error message to provide some context.

Specifically for the case of improperly folded lines.

8 years agoFixed flex fixups to not break LFLAGS.
David Levine [Sat, 15 Jul 2017 13:37:26 +0000 (09:37 -0400)]
Fixed flex fixups to not break LFLAGS.

Addresses comment added in commit 4ac978448.

8 years agoAdded flex fixup for Fedora 26's flex 2.6.1.
David Levine [Sat, 15 Jul 2017 13:16:47 +0000 (09:16 -0400)]
Added flex fixup for Fedora 26's flex 2.6.1.

The fix is compatible with unpatched flex 2.6.1.

8 years agoStart of work to fix lack of address rewriting for bcc
Ken Hornstein [Fri, 23 Jun 2017 15:53:28 +0000 (11:53 -0400)]
Start of work to fix lack of address rewriting for bcc

This is the start of work to fix the problems described in #51098.  Is
not finished yet.

8 years agoRearranged statements to eliminate memory allocation.
David Levine [Sat, 17 Jun 2017 17:42:59 +0000 (13:42 -0400)]
Rearranged statements to eliminate memory allocation.

Update to commit a5bf16c0928cb4044b082f9cf6f44f9bb3998824.

8 years agoShow display program name and arguments in error message if it fails.
David Levine [Sat, 17 Jun 2017 15:01:32 +0000 (11:01 -0400)]
Show display program name and arguments in error message if it fails.

8 years agoDon't bypass scan_content() when expanding pseudoheaders.
David Levine [Sat, 17 Jun 2017 13:32:00 +0000 (09:32 -0400)]
Don't bypass scan_content() when expanding pseudoheaders.

expand_pseudoheader() would avoid the call to scan_content() in order
to inhibit use of quoted-printable for text content.  Removed that;
the user still has control over the use of quoted-printable via
-maxunencoded.  Though now, lines over 998 bytes long will always
be encoded.

8 years agosbr/netsec.c: Report popped TLS error code, don't pop again.
Ralph Corderoy [Sat, 10 Jun 2017 17:32:08 +0000 (18:32 +0100)]
sbr/netsec.c: Report popped TLS error code, don't pop again.

ERR_get_error() pops an error code so having tested that value it should
also be the one that's reported in an error message, not another popped
error code by calling ERR_get_error() again as this misleads as to the
error's cause.

8 years agouip/inc.c: Don't increment variable of type bool.
Ralph Corderoy [Tue, 30 May 2017 22:00:10 +0000 (23:00 +0100)]
uip/inc.c: Don't increment variable of type bool.

gcc 7.1.1 is warning against incrementing `bool' variables.
Assign true instead.

8 years agoFixed double fclose().
David Levine [Thu, 1 Jun 2017 23:54:21 +0000 (19:54 -0400)]
Fixed double fclose().

8 years agoRemove ancient SENDMAILBUG code.
Ken Hornstein [Thu, 1 Jun 2017 16:26:23 +0000 (12:26 -0400)]
Remove ancient SENDMAILBUG code.

Old SMTP code used to treat a code 451 the same as code 250 (success).  It's
not clear if this was ever a real bug in sendmail, but regardless this code
is long obsolete.

8 years agoComment cleanup; removed ancient reference to 4.2BSD systems.
Ken Hornstein [Thu, 1 Jun 2017 16:25:15 +0000 (12:25 -0400)]
Comment cleanup; removed ancient reference to 4.2BSD systems.

8 years agoNormalize connection shutdown handling.
Ken Hornstein [Wed, 31 May 2017 18:39:48 +0000 (14:39 -0400)]
Normalize connection shutdown handling.

I originally tried to make things work so that the netsec client code gave
the client the option of closing the file descriptors if it wanted to, but
I was running into a problem where if TLS negotiation failed part of the
negotiation would be interpreted as connection data.  The code has been
changed to have the sockets close when the SSL BIO is released and to
have netsec_shutdown unconditionally close the file descriptors.

8 years agoUse original error code from OpenSSL.
Ken Hornstein [Wed, 31 May 2017 15:53:47 +0000 (11:53 -0400)]
Use original error code from OpenSSL.

Reuse the error code we already retrieved from OpenSSL, otherwise the
error might be cleared the next time we call ERR_get_error().

8 years agosbr/brkstring.c: Use strchr(3) in brkany(), not own loop.
Ralph Corderoy [Mon, 29 May 2017 12:20:00 +0000 (13:20 +0100)]
sbr/brkstring.c: Use strchr(3) in brkany(), not own loop.

8 years agosizeof char is always 1, so don't bother to divide by it.
Ralph Corderoy [Mon, 29 May 2017 11:56:10 +0000 (12:56 +0100)]
sizeof char is always 1, so don't bother to divide by it.

8 years agoUse DIM(a) macro a few more times; array's dimension using sizeof.
Ralph Corderoy [Mon, 29 May 2017 11:53:24 +0000 (12:53 +0100)]
Use DIM(a) macro a few more times;  array's dimension using sizeof.

8 years agouip/scansbr.c: Add PUTC() macro, similar to FPUTS().
Ralph Corderoy [Mon, 29 May 2017 11:23:38 +0000 (12:23 +0100)]
uip/scansbr.c: Add PUTC() macro, similar to FPUTS().

FPUTS() exists, but all the putc(3) checks for error were written
alongside in longhand.  May as well have a PUTC() to match, though
perhaps just the existing check of the FILE's sticky error state with
ferror(3) is sufficient and neither macro is required.

8 years agouip/scansbr.c: Stop `scan -file' copying mailbox to /dev/null.
Ralph Corderoy [Mon, 29 May 2017 10:49:29 +0000 (11:49 +0100)]
uip/scansbr.c: Stop `scan -file' copying mailbox to /dev/null.

scan() was copying the mailbox to /dev/null when called for `scan -file
foo.mbox' because it used outnum being non-zero as the test of whether
to write instead of FILE pointer scnout being non-NULL.  By switching,
we can avoid the opening of /dev/null that was just to give scnout a
valid value for the needless fputs(3), etc.

Add comment explaining scan()'s outnum input parameter's three
functions: -1, 0, and positive.