]> diplodocus.org Git - nmh/log
nmh
8 years agoUse FENDNULL() instead of duplicate, locally defined, empty().
Ralph Corderoy [Sat, 13 May 2017 12:24:03 +0000 (13:24 +0100)]
Use FENDNULL() instead of duplicate, locally defined, empty().

Three files had an empty() that was defined using FENDNULL();  use the
latter directly.

8 years agoAdd FENDNULL(s): fends off NULL by giving an empty string instead.
Ralph Corderoy [Sat, 13 May 2017 12:13:18 +0000 (13:13 +0100)]
Add FENDNULL(s): fends off NULL by giving an empty string instead.

Use it in place of all the `foo->bar_xyzzy ? foo->bar_xyzzy : ""'.
Avoids the reader having to check first two of the ternary operands are
the same.

8 years agosbr/mf.c: Rename path to routepath to avoid h/mh.h clash.
Ralph Corderoy [Sat, 13 May 2017 11:56:58 +0000 (12:56 +0100)]
sbr/mf.c: Rename path to routepath to avoid h/mh.h clash.

Adding #include of h/mh.h brings two path global symbols together;
path() and char *path.  Rename the latter.  h/mh.h is needed by a future
commit.

8 years agoReplace `a == b ? 1 : 0' and similar with `a == b'.
Ralph Corderoy [Fri, 12 May 2017 22:29:31 +0000 (23:29 +0100)]
Replace `a == b ? 1 : 0' and similar with `a == b'.

8 years agoReplace `e ? 0 : 1' with `!e'.
Ralph Corderoy [Fri, 12 May 2017 22:14:43 +0000 (23:14 +0100)]
Replace `e ? 0 : 1' with `!e'.

Needs less thought to read.

8 years agosbr/icalparse.y: Replace max(BUFSIZ, 8192) with NMH_BUFSIZ.
Ralph Corderoy [Fri, 12 May 2017 21:45:34 +0000 (22:45 +0100)]
sbr/icalparse.y: Replace max(BUFSIZ, 8192) with NMH_BUFSIZ.

8 years agoUse existing macros min() and max() more.
Ralph Corderoy [Fri, 12 May 2017 21:42:35 +0000 (22:42 +0100)]
Use existing macros min() and max() more.

8 years agoClarified the phrasing added by commit 44ce2010.
David Levine [Fri, 12 May 2017 02:41:02 +0000 (22:41 -0400)]
Clarified the phrasing added by commit 44ce2010.

8 years agoAdded warning about when post(1) can't refile(1) a draft.
David Levine [Fri, 12 May 2017 00:20:16 +0000 (20:20 -0400)]
Added warning about when post(1) can't refile(1) a draft.

8 years agosbr/fmt_scan.c: Fix `foo%-42{bar}' right-justification bug.
Ralph Corderoy [Wed, 10 May 2017 11:13:28 +0000 (12:13 +0100)]
sbr/fmt_scan.c: Fix `foo%-42{bar}' right-justification bug.

The space padding was added at the start of the output buffer, not the
start of the component being formatted.  Caused by 92128dac's move to
dynamic allocation for fmt_scan()'s output.  Only shows if the component
isn't at the start of the buffer.  Expand existing
test/format/test-rightjustify to cover this.

8 years agoconfig/version.sh: Rewrite. Use uname(1), git-describe(1), and UTC.
Ralph Corderoy [Tue, 9 May 2017 22:10:06 +0000 (23:10 +0100)]
config/version.sh: Rewrite.  Use uname(1), git-describe(1), and UTC.

Not sure why it searched through PATH manually for uname(1) and
hostname(1).  uname and its -n option are POSIX so just use those.  It
was the preference over hostname anyway.

Use git-describe(1), not just git-branch(1), as it gives more detail,
including --dirty to show the built source differs from the commit.

Specify the format for the build date, and its timezone; +0000.

8 years agosbr/mf.c: Simplify isat(); it's /^ at /i.
Ralph Corderoy [Tue, 9 May 2017 21:48:11 +0000 (22:48 +0100)]
sbr/mf.c: Simplify isat();  it's /^ at /i.

This one's for all those RFC 733 emails out there.
You know who you are.

8 years agouip/inc.c: Use bool, not int, for some of the options.
Ralph Corderoy [Sun, 7 May 2017 22:30:46 +0000 (23:30 +0100)]
uip/inc.c: Use bool, not int, for some of the options.

Makes clear there's no special meaning to repeating these options more
than once.

8 years agosbr/netsec.c: Remove extraneous semicolon.
Ralph Corderoy [Sun, 7 May 2017 21:43:19 +0000 (22:43 +0100)]
sbr/netsec.c: Remove extraneous semicolon.

8 years agoSplit some comma-operator terms into separate statements.
Ralph Corderoy [Sun, 7 May 2017 21:35:41 +0000 (22:35 +0100)]
Split some comma-operator terms into separate statements.

Some uses of the comma operator weren't the idiomatic `p++, len--'.
Split its terms into two statements instead, e.g. `close(fd); fd = -1'.

8 years agouip/picksbr.c: Increase line-buffer size for "grep" action.
Ralph Corderoy [Sun, 7 May 2017 17:02:03 +0000 (18:02 +0100)]
uip/picksbr.c: Increase line-buffer size for "grep" action.

Alter LBSIZE from 1024 to NMH_BUFSIZ, e.g. 8192.  This dominates the
size of the char array used to hold a single unfolded header line when
evaluating a "grep" action, e.g. `-to foo' becomes `^to[ ^I]*:.*foo'.

8 years agouip/scansbr.c: Replace uses of SBUFSIZ with NMH_BUFSIZ.
Ralph Corderoy [Sun, 7 May 2017 13:01:48 +0000 (14:01 +0100)]
uip/scansbr.c: Replace uses of SBUFSIZ with NMH_BUFSIZ.

Now that the former is defined as the latter, the uses of SBUFSIZ were
all in the same expression and it simplifies from a ternary expression
to NMH_BUFSIZ.

8 years agouip/rcvdist.c: Replace SBUFSIZ with NMH_BUFSIZ.
Ralph Corderoy [Sun, 7 May 2017 12:57:39 +0000 (13:57 +0100)]
uip/rcvdist.c: Replace SBUFSIZ with NMH_BUFSIZ.

The former was defined as the latter and had only one proper use: to
size a char array.  The other uses should have been the sizeof operator
on that array, and now are.

8 years agouip/replsbr.c: Replace single use of SBUFSIZ with NMH_BUFSIZ.
Ralph Corderoy [Sun, 7 May 2017 12:56:40 +0000 (13:56 +0100)]
uip/replsbr.c: Replace single use of SBUFSIZ with NMH_BUFSIZ.

The former was defined as the latter;  not a lot of point having it.

8 years agoMake many m_getfld() buffer parameters NMH_BUFSIZ big.
Ralph Corderoy [Sun, 7 May 2017 12:03:01 +0000 (13:03 +0100)]
Make many m_getfld() buffer parameters NMH_BUFSIZ big.

char arrays were often stdio.h's BUFSIZ large, and that's 8192 with here
with glibc 2.25-1 on Linux x86_64, so using NMH_BUFSIZ is no different
as that's max(BUFSIZ, 8192).  But some were 256 or 512 with a local
SBUFSIZ macro and they caused scan(1) to truncate a field, or pick(1) to
not spot text because the field was truncated.

Delete bad-input/test-header's test for m_getfld()'s detection for a
header without a colon that's under the header-length NAMESZ limit, but
longer than the passed in buffer.  This no longer happens in scan as the
buffer is larger than the longest allowed header.

8 years agoconfigure.ac: Enable assert(3) by default.
Ralph Corderoy [Fri, 5 May 2017 12:11:15 +0000 (13:11 +0100)]
configure.ac: Enable assert(3) by default.

Revert 167e542b that disabled assert(3) by default after private email
discussion with David Levine.  I suggested it being enabled by default
in git so those running nmh from git were testing them for us, with it
being disabled as part of the release process so packagers continue with
it disabled.  David pointed out that would make the release
intentionally different from what had been long tested so the default is
now enabled assertions everywhere unless disabled by a packager.

8 years agomhstoresbr.c: Flip logic to simplify. Remove else after continue.
Ralph Corderoy [Mon, 1 May 2017 22:02:06 +0000 (23:02 +0100)]
mhstoresbr.c: Flip logic to simplify.  Remove else after continue.

Former in store_partial(), latter in parse_format_string().

8 years agomhlsbr.c: Flip parse()'s logic. Remove oneline()'s else after break.
Ralph Corderoy [Mon, 1 May 2017 21:57:44 +0000 (22:57 +0100)]
mhlsbr.c: Flip parse()'s logic.  Remove oneline()'s else after break.

8 years agodropsbr.c: Flip mbx_open()'s logic to simplify.
Ralph Corderoy [Mon, 1 May 2017 21:56:30 +0000 (22:56 +0100)]
dropsbr.c: Flip mbx_open()'s logic to simplify.

8 years agobase64.c: Remove some else after break. Flip logic to simplify.
Ralph Corderoy [Mon, 1 May 2017 21:47:38 +0000 (22:47 +0100)]
base64.c: Remove some else after break.  Flip logic to simplify.

8 years agomhfixmsg.c: Flip logic to simplify. Remove else after break.
Ralph Corderoy [Mon, 1 May 2017 21:46:38 +0000 (22:46 +0100)]
mhfixmsg.c: Flip logic to simplify.  Remove else after break.

8 years agopath.c: Simplify compath()'s flow; return, don't break twice.
Ralph Corderoy [Mon, 1 May 2017 21:36:30 +0000 (22:36 +0100)]
path.c: Simplify compath()'s flow;  return, don't break twice.

8 years agomhshowsbr.c: Remove else after break in iconv_start().
Ralph Corderoy [Mon, 1 May 2017 20:49:38 +0000 (21:49 +0100)]
mhshowsbr.c: Remove else after break in iconv_start().

8 years agomhparse.c: Remove a couple of else after continue.
Ralph Corderoy [Mon, 1 May 2017 20:46:20 +0000 (21:46 +0100)]
mhparse.c: Remove a couple of else after continue.

In openQuoted() and parse_header_attrs().

8 years agom_getfld.c: Remove else after break in m_unknown() and m_Eom().
Ralph Corderoy [Mon, 1 May 2017 20:43:36 +0000 (21:43 +0100)]
m_getfld.c: Remove else after break in m_unknown() and m_Eom().

8 years agopicksbr.c: Remove some else after break in plist().
Ralph Corderoy [Mon, 1 May 2017 20:42:59 +0000 (21:42 +0100)]
picksbr.c: Remove some else after break in plist().

8 years agofmt_rfc2047.c: Remove else after decode_rfc2047()'s break.
Ralph Corderoy [Mon, 1 May 2017 17:42:07 +0000 (18:42 +0100)]
fmt_rfc2047.c: Remove else after decode_rfc2047()'s break.

8 years agosortm.c: Flip get_fields()'s logic to simplify.
Ralph Corderoy [Mon, 1 May 2017 17:33:15 +0000 (18:33 +0100)]
sortm.c: Flip get_fields()'s logic to simplify.

8 years agoREADME.developers: Add pointers to Debian's Lintian's complaints.
Ralph Corderoy [Sun, 30 Apr 2017 14:25:20 +0000 (15:25 +0100)]
README.developers: Add pointers to Debian's Lintian's complaints.

8 years agoREADME.developers: Add blank lines for consistent headers.
Ralph Corderoy [Sun, 30 Apr 2017 14:14:46 +0000 (15:14 +0100)]
README.developers: Add blank lines for consistent headers.

8 years agoFix spelling in C comments.
Ralph Corderoy [Fri, 28 Apr 2017 23:01:58 +0000 (00:01 +0100)]
Fix spelling in C comments.

8 years agobvector_copy: Use bvector's tiny storage if big enough.
Ralph Corderoy [Fri, 28 Apr 2017 21:42:46 +0000 (22:42 +0100)]
bvector_copy: Use bvector's tiny storage if big enough.

Otherwise a source bvector that's using tiny storage has its bits
duplicated into a malloc'd area when the destination's tiny storage was
sufficient.

8 years agosbr/oauth.c: Remove const to avoid curl's debug_callback warning.
Ralph Corderoy [Fri, 28 Apr 2017 21:08:26 +0000 (22:08 +0100)]
sbr/oauth.c: Remove const to avoid curl's debug_callback warning.

The curl_debug_callback typedef doesn't use const for any of the
function's parameters.  On one of the compilation platforms here,
oauth.c's debug_callback having const specifiers for some parameters
causes compilation warnings, and -Werror stops the compilation.  Remove
them.

8 years agosbr/folder_read.c: Don't malloc() once per message.
Ralph Corderoy [Fri, 28 Apr 2017 16:12:31 +0000 (17:12 +0100)]
sbr/folder_read.c: Don't malloc() once per message.

Instead of struct msgs having a pointer to a malloc'd array of pointers,
each to a malloc'd struct bvector, 1+N, it now has a pointer to a
malloc'd array of struct bvector;  one malloc for all of them.  This
avoids the large number of calls to malloc() and free() that's linear
with the size of the folder.

But there are some downsides.  In order to step through an array of
struct bvector, code outside of sbr/vector.c needs to know the struct's
size.  The simplest way to do this is to make the struct's definition
public, with a comment that access should be through vector.c.

New functions are needed to initialise the content of an already
allocated bvector, and to finish with its content prior to deallocation.
bvector_create() and bvector_free() now also use these new functions.

Before, it was the array of pointers to bvector that would be realloc'd.
That doesn't work for the array of bvectors as they may contain pointers
to within themselves.  The solution is to malloc a new array and
bvector_copy() the ones to keep across, as folder_realloc() now does.
The other half of its logic that coped with growth at the end of the
array, has been deleted.  Also deleted, is the code to clear the
bvectors before and after the old ones as they start in that state.

8 years agovalgrind: Add suppression for dbm_open(3)'s write(2).
Ralph Corderoy [Fri, 28 Apr 2017 16:00:54 +0000 (17:00 +0100)]
valgrind: Add suppression for dbm_open(3)'s write(2).

It writes bytes from an area it mallocs, but doesn't set all of those
bytes first.  See with gdbm 1.13-1 on Arch Linux.

8 years agosbr/vector.c: Only allocate bvector storage for set bits.
Ralph Corderoy [Fri, 28 Apr 2017 11:45:26 +0000 (12:45 +0100)]
sbr/vector.c: Only allocate bvector storage for set bits.

Now that a pointer to all the bit storage doesn't escape vector.c,
there's no need to allocate storage, that's initialised to 0, just to
then clear a bit in it.  Only extend the bits's storage for set bits.
Remove the unused initial size parameter from bvector_create() as it
simplifies the implementation.

8 years agosbr/vector.c: Add bvector comments, tidy identifiers.
Ralph Corderoy [Fri, 28 Apr 2017 11:27:44 +0000 (12:27 +0100)]
sbr/vector.c: Add bvector comments, tidy identifiers.

8 years agosbr/vector.c: Rewrite BVEC_BYTES(n) macro to remove branch.
Ralph Corderoy [Fri, 28 Apr 2017 11:16:01 +0000 (12:16 +0100)]
sbr/vector.c: Rewrite BVEC_BYTES(n) macro to remove branch.

Use the idiom of integer truncation.

8 years agosbr/vector.c: Use new BVEC_BITS_BITS macro.
Ralph Corderoy [Fri, 28 Apr 2017 11:12:15 +0000 (12:12 +0100)]
sbr/vector.c: Use new BVEC_BITS_BITS macro.

Factors out a common expression from a few other places.

8 years agosbr/vector.c: Zero the growth with memset(3), not loop.
Ralph Corderoy [Wed, 26 Apr 2017 23:14:28 +0000 (00:14 +0100)]
sbr/vector.c: Zero the growth with memset(3), not loop.

When the resize functions grow the vectors, as they always do, zero the
new slots with memset(3) rather than a for loop.  Particularly of note
for the bit vector where it was bvector_clear()ing one bit at a time.
Although a NULL pointer needn't have a representation of all-zero bits,
the code was already assuming that, e.g. on the initial allocation, so
we're no worse off.

8 years agosbr/vector.c: Change bvector_bits() to return first word.
Ralph Corderoy [Wed, 26 Apr 2017 12:41:27 +0000 (13:41 +0100)]
sbr/vector.c: Change bvector_bits() to return first word.

Rename it to bvector_first_bits() to represent its new behaviour.  It
has only one caller that uses it to produce debug.  Tighten the API so
other callers don't get access to the location of the bvector's bits.

8 years agosbr/vector.c: Embed initial vector storage in header struct.
Ralph Corderoy [Tue, 25 Apr 2017 22:21:21 +0000 (23:21 +0100)]
sbr/vector.c: Embed initial vector storage in header struct.

Instead of a malloc(3)'d struct bvector having a pointer to a separately
malloc'd area for the bits in the normal case of the default initial
size, have non-malloc'd storage in the struct itself, and set the
pointer to that.  It's two unsigned longs, which is less than the
previous default of 256 bits for struct bvector, but still double the
pre-bvector norm of one word on 32 and 64-bit architectures.

This halves the mallocs needed to create a struct bvector in the common
case, but does mean that embedded memory is wasted should it not be
enough.  That's probably an unusual case.  It also means derefencing the
pointer to the bits probably hits the same cache line.

Have separate initial sizes for string and int vectors.

8 years agosbr/vector.c: Remove `vec' argument from BVEC_OFFSET(), etc.
Ralph Corderoy [Mon, 24 Apr 2017 23:20:08 +0000 (00:20 +0100)]
sbr/vector.c: Remove `vec' argument from BVEC_OFFSET(), etc.

A few macros took a struct bvector pointer as their first argument just
to get the sizeof one of its fields.  This can be done with a NULL
pointer so remove that argument from all of them.

8 years agosbr/vector.c: Delete unused bvector_maxsize() and ivector_size().
Ralph Corderoy [Mon, 24 Apr 2017 22:47:46 +0000 (23:47 +0100)]
sbr/vector.c: Delete unused bvector_maxsize() and ivector_size().

May as well keep the proffered interface as small as possible so the
implementation can make greater assumptions knowing some internal
details aren't available.

8 years agosbr/vector.c: Move assert(3)s into bvector_create().
Ralph Corderoy [Mon, 24 Apr 2017 21:58:56 +0000 (22:58 +0100)]
sbr/vector.c: Move assert(3)s into bvector_create().

Rather than asserting on every bit-related operation, assert just when
creating the vector.  Whether the assertion is true is decided at
compile time, so it only needs checking once;  once for every vector is
an easy compromise.

8 years agosbr/vector.c: Replace Nbby with <limits.h>'s CHAR_BIT.
Ralph Corderoy [Mon, 24 Apr 2017 21:08:09 +0000 (22:08 +0100)]
sbr/vector.c: Replace Nbby with <limits.h>'s CHAR_BIT.

POSIX mandates CHAR_BIT is 8;  see stdint.h(0p).

8 years agosbr/vector.c: calloc(3) rather than malloc(3) and memset(3).
Ralph Corderoy [Mon, 24 Apr 2017 20:19:56 +0000 (21:19 +0100)]
sbr/vector.c: calloc(3) rather than malloc(3) and memset(3).

calloc(3) tells libc upfront that the memory needs to be zeroed rather
than giving it the news later with memset.  Perhaps this allows it to
allocate from a CoW page of zero bytes, or it benefits from some other
way in memset not having to clear each bit, but it knocks about 15% off
the wall-clock time and the number of library calls under ltrace(1).

8 years agosbr/folder_read.c: Don't clear newly created bvectors.
Ralph Corderoy [Mon, 24 Apr 2017 20:13:52 +0000 (21:13 +0100)]
sbr/folder_read.c: Don't clear newly created bvectors.

The newly created bvectors are already clear;  don't loop clearing each
again with memset(3).

8 years agosbr/fmt_scan.c: Only wcwidth(3) a valid mbtowc(3) result.
Ralph Corderoy [Tue, 25 Apr 2017 23:14:26 +0000 (00:14 +0100)]
sbr/fmt_scan.c: Only wcwidth(3) a valid mbtowc(3) result.

The assert(3) added by 80a9e99f7078199500d2d53c8d77d1b92af06fbc is
failing, but not reproducibly.  It's probable that mbtowc() is returning
a negative, and not altering wide_char, leaving it as random stack
content.  Taking its wcwidth() then sometimes also returns negative,
causing the assert() failure.  Initialising wide_char before the call
isn't a solution as it isn't documented if it's modified to an invalid
value on an error return.

Instead, delay calculating the wcwidth() until after the possible
substitution of "?".  Leave the assert() in place.

8 years agoRemove return statements at end of void functions.
Ralph Corderoy [Sun, 23 Apr 2017 15:17:09 +0000 (16:17 +0100)]
Remove return statements at end of void functions.

8 years agotws.h: Remove ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST.
Ralph Corderoy [Sun, 23 Apr 2017 15:10:59 +0000 (16:10 +0100)]
tws.h: Remove ADJUST_NUMERIC_ONLY_TZ_OFFSETS_WRT_DST.

Code that's conditional on its definition has been kept;  just the tests
removed.  The comment explaining its purpose has been kept, just without
the "If defined...".

8 years agoUse C's `++', `+=', etc., not the longhand.
Ralph Corderoy [Sun, 23 Apr 2017 14:48:53 +0000 (15:48 +0100)]
Use C's `++', `+=', etc., not the longhand.

8 years agoRemove unneeded incomplete, member-less `struct tag;'.
Ralph Corderoy [Sun, 23 Apr 2017 14:19:33 +0000 (15:19 +0100)]
Remove unneeded incomplete, member-less `struct tag;'.

The forward declaration isn't needed to typedef based on the struct.

8 years agomh.h: Compact the reserved sequence bit-masks.
Ralph Corderoy [Sun, 23 Apr 2017 13:47:20 +0000 (14:47 +0100)]
mh.h: Compact the reserved sequence bit-masks.

Removes the gap created by axing DELETED.

8 years agomh.h: Remove unused MODIFIED and DELETED macros.
Ralph Corderoy [Sun, 23 Apr 2017 13:36:57 +0000 (14:36 +0100)]
mh.h: Remove unused MODIFIED and DELETED macros.

MODIFIED was a folder attribute used by msh(1), and DELETED a message
attribute that may have last been used in the 1980s.
Adjust corresponding FBITS and MBITS definitions.

8 years agomd5.h: Remove unused UINT2 typedef for unsigned short.
Ralph Corderoy [Sun, 23 Apr 2017 13:36:47 +0000 (14:36 +0100)]
md5.h: Remove unused UINT2 typedef for unsigned short.

8 years agoap.man, dp.man: Add fmttest(1) to SEE ALSO section.
Ralph Corderoy [Sun, 23 Apr 2017 12:50:02 +0000 (13:50 +0100)]
ap.man, dp.man: Add fmttest(1) to SEE ALSO section.

8 years agotws.h: Remove zero-valued TW_SNIL macro, used once.
Ralph Corderoy [Sun, 23 Apr 2017 12:33:57 +0000 (13:33 +0100)]
tws.h: Remove zero-valued TW_SNIL macro, used once.

Macro TW_SNIL was the zero value for a two-bit field.  It was only used
once, and that is better ordered to check for bits set with none set
being the last, else, case, rather than in the middle.  Kept the
behaviour of undefined value 3 being treated as TW_SIMP, 2.

8 years agotws.h: Remove redundant TW_SZONE and TW_SZNIL bit-masks.
Ralph Corderoy [Sun, 23 Apr 2017 12:18:20 +0000 (13:18 +0100)]
tws.h: Remove redundant TW_SZONE and TW_SZNIL bit-masks.

TW_SZONE is a mask of one bit that can either be 0, TW_SZNIL, or set,
TW_SZEXP.  Rather than three macros for the single  bit, have one,
TW_SZEXP.  Simplifies the test too when the mask is known to be one-bit
wide.

8 years agomh-format.man: Fix `Return' column heading alignment.
Ralph Corderoy [Sun, 23 Apr 2017 10:01:18 +0000 (11:01 +0100)]
mh-format.man: Fix `Return' column heading alignment.

Two of the column headings were separated by spaces rather than a tab.
The other two similar tables used `Return' instead of `Result', so
switch to that at the same time.

8 years agosbr/dtime.c: Remove struct-assigning twscopy().
Ralph Corderoy [Sun, 23 Apr 2017 08:48:13 +0000 (09:48 +0100)]
sbr/dtime.c: Remove struct-assigning twscopy().

Historically, twscopy() assigned all the struct's members individually,
but that was `#if 0'd as far back as the repository goes.  The one
caller now uses assignment, making clear the direction of data flow.

8 years agouip/sortm.c: Remove unused variable and dlocaltimenow() call.
Ralph Corderoy [Sun, 23 Apr 2017 08:28:24 +0000 (09:28 +0100)]
uip/sortm.c: Remove unused variable and dlocaltimenow() call.

read_hdrs() has a auto `struct tws tb'.  It's only use is as the
destination for dlocaltimenow()'s result.  Remove the variable.  Also
remove the dlocaltimenow() call;  this I'm unsure about as it has a side
effect of calling tzset(3).  However, tests pass.  Repository history
sheds no light.

8 years agosbr/dtimep.l: Remove always false `europeandate' flag.
Ralph Corderoy [Sun, 23 Apr 2017 08:19:13 +0000 (09:19 +0100)]
sbr/dtimep.l: Remove always false `europeandate' flag.

Switched from reverse-podium MM/DD/YY interpretation to DD/MM/YY.
Never set so conditional code unused.

8 years agoAppend descriptions to C source files with first-line filenames.
Ralph Corderoy [Sat, 22 Apr 2017 23:47:32 +0000 (00:47 +0100)]
Append descriptions to C source files with first-line filenames.

8 years agoAdd first-line comment describing C source's purpose.
Ralph Corderoy [Sat, 22 Apr 2017 23:29:02 +0000 (00:29 +0100)]
Add first-line comment describing C source's purpose.

I had a stab at them after a bit of a skim;  they're better than
nothing.

8 years agoEnsure a space after `#!'.
Ralph Corderoy [Sat, 22 Apr 2017 23:02:41 +0000 (00:02 +0100)]
Ensure a space after `#!'.

The majority of the `#!' scripts have a space before the `/';
add one to the three deviants.

8 years agoCorrect first-line comments where filename is wrong.
Ralph Corderoy [Sat, 22 Apr 2017 22:36:19 +0000 (23:36 +0100)]
Correct first-line comments where filename is wrong.

Having jiggled the start-of-file comment about, it's apparent that a few
files either don't know their own name, or the format the rest of the
gang follow.  To wit, "basename(filename) -- ...".

8 years agoReplace "/*\n * " with "/* " at the start of a file.
Ralph Corderoy [Sat, 22 Apr 2017 22:19:39 +0000 (23:19 +0100)]
Replace "/*\n * " with "/* " at the start of a file.

Pulls the meat of the comment onto the file's first line, now that the
blank line at the start of the file has been deleted.  Allows `sed -ns
1p ...' or similar to give a summary of lots of files.

8 years agoRemove leading and trailing blank lines from code.
Ralph Corderoy [Sat, 22 Apr 2017 18:05:32 +0000 (19:05 +0100)]
Remove leading and trailing blank lines from code.

Many of the main source file start with a blank line, and many end with
one or more too.  They seem to serve little purpose so delete them.
This makes all the files consistent in not having them and ideally the
first line of a C source file will say something about its content in
time instead of just "/*".  Avoided editing format files, etc,. where
the line could be significant, and historical files.

8 years agomts/smtp/smtp.h: Remove one-use rp_isbad() macro.
Ralph Corderoy [Sat, 22 Apr 2017 17:37:15 +0000 (18:37 +0100)]
mts/smtp/smtp.h: Remove one-use rp_isbad() macro.

It just cast its argument to signed char, and the sole user can do that
itself a few lines later.

8 years agomts/smtp/smtp.h: Remove unused `MMDF' macros.
Ralph Corderoy [Sat, 22 Apr 2017 17:32:55 +0000 (18:32 +0100)]
mts/smtp/smtp.h: Remove unused `MMDF' macros.

The header file has a specification of a historical interface and
removing the unused parts leaves it incomplete, but it's unlikely those
parts will be needed and what remains seems more understandable;  partly
due to it being less to grok, and also because it relates more to modern
use.

8 years agomts/smtp/smtp.c: Remove unused SM_... timeout macros.
Ralph Corderoy [Sat, 22 Apr 2017 17:21:01 +0000 (18:21 +0100)]
mts/smtp/smtp.c: Remove unused SM_... timeout macros.

SM_TEXT, SM_CLOS, and SM_AUTH are unused.
Alter the comment for the block of macros to state they're timeouts in
seconds.

8 years agoh/mf.h: Remove many unused macros; some UUCP related.
Ralph Corderoy [Sat, 22 Apr 2017 16:28:18 +0000 (17:28 +0100)]
h/mf.h: Remove many unused macros;  some UUCP related.

MF... were "Codes returned by uucp2mmdf(), mmdf2uucp()".
A spot check of the others shows they've not been used in this git
repository.

8 years agosbr/mf.c: Remove unused functions: isfrom, lequal, mfgets.
Ralph Corderoy [Sat, 22 Apr 2017 16:16:54 +0000 (17:16 +0100)]
sbr/mf.c: Remove unused functions: isfrom, lequal, mfgets.

isfrom(s) checked for /^>?From /.
lequal(a, b) was another case-insensitive strcmp(3).
mfgets(fp, line) fetched a header at a time from fp, indicating when the
end of headers was reached.
Investigating their historical usage was, ironically, made too tedious
to complete by the pollution of mass commits of historical MH.

8 years agouip/mhbuildsbr.c: Remove unusused MAXURLTOKEN macro.
Ralph Corderoy [Sat, 22 Apr 2017 15:51:02 +0000 (16:51 +0100)]
uip/mhbuildsbr.c: Remove unusused MAXURLTOKEN macro.

"Maximum size of URL token in message/external-body".
Uses deleted in 95ad91ca30e1cda09efe454d12ed790a60661f56.

8 years agosbr/dtime.c: Remove unused `struct zone' definition.
Ralph Corderoy [Sat, 22 Apr 2017 15:48:13 +0000 (16:48 +0100)]
sbr/dtime.c: Remove unused `struct zone' definition.

The uses went in 6a68057d8ef48bef3ee752741a53a629a2840e68.

8 years agouip/post.c: Don't bother naming `struct oauth_profile'.
Ralph Corderoy [Sat, 22 Apr 2017 15:46:33 +0000 (16:46 +0100)]
uip/post.c: Don't bother naming `struct oauth_profile'.

It's never used, and one more identifier to track when reading.
If there's no name, that's a signal it's not used elsewhere.

8 years agoh/nmh.h: Remove unused NLENGTH(dirent) macro.
Ralph Corderoy [Sat, 22 Apr 2017 15:42:51 +0000 (16:42 +0100)]
h/nmh.h: Remove unused NLENGTH(dirent) macro.

It just does a strlen(3) of its argument's d_name;  that's not even done
longhand anyway.  And its name is very generic for such a narrow task.

8 years agoh/mts.h: Remove unused isdlm{1,2}() macros.
Ralph Corderoy [Sat, 22 Apr 2017 15:41:00 +0000 (16:41 +0100)]
h/mts.h: Remove unused isdlm{1,2}() macros.

They just do a strcmp(3) of their argument against mmdlm{1,2} and test
it's "equal".  That's more clearly written longhand than have yet
another small-scope, specialised, macro to recall;  as practice bears
out.

8 years agoh/mh.h: Remove unused set_deleted() macro.
Ralph Corderoy [Sat, 22 Apr 2017 15:39:29 +0000 (16:39 +0100)]
h/mh.h: Remove unused set_deleted() macro.

Its comment says "for msh only".

8 years agoh/tws.h: Remove TW_YES and TW_NO; TW_SUCC good enough.
Ralph Corderoy [Sat, 22 Apr 2017 13:31:10 +0000 (14:31 +0100)]
h/tws.h: Remove TW_YES and TW_NO;  TW_SUCC good enough.

TW_SUCC is a macro for the bit-mask 0x0040.  TW_YES, a vague name, was
the same value.  TW_NO was 0, and unused by the code.  Ditch both those
as TW_SUCC is sufficient for setting and testing.  Alter its comment to
make clear it means parsing was successful.

8 years agodocs/FAQ: Replace suggestion of NOMHNPROC with -nocheckmime.
Ralph Corderoy [Sat, 22 Apr 2017 13:10:41 +0000 (14:10 +0100)]
docs/FAQ: Replace suggestion of NOMHNPROC with -nocheckmime.

Environment variable NOMHNPROC was removed in 1.6, as stated in NEWS.

8 years agosbr/discard.c: Simplify by inverting initial test.
Ralph Corderoy [Sat, 22 Apr 2017 00:00:29 +0000 (01:00 +0100)]
sbr/discard.c: Simplify by inverting initial test.

The function used to return early, but these days that's just avoiding a
single statement, so execute that conditionally instead.

8 years agosbr/lock_file.c: Move static variables into their functions.
Ralph Corderoy [Fri, 21 Apr 2017 23:48:47 +0000 (00:48 +0100)]
sbr/lock_file.c: Move static variables into their functions.

A couple of file-scoped statc ints were the typical "if this function is
being called for the first time" flags.  Move each into their respective
functions.  Make them bools.  Name them so the initial value is zero,
thus placing them in BSS.

8 years agosend and whatnow: Remove deprecated -attach... switches.
Ralph Corderoy [Fri, 21 Apr 2017 13:01:21 +0000 (14:01 +0100)]
send and whatnow: Remove deprecated -attach... switches.

They were changed to do nothing but warn on stderr that they were
deprecated in 521674623 and 035c5db34, both before 1.6's release, and so
can be removed ready for 1.7's release.

8 years agouip/dropsbr.c: Fix buffer overrun in mbx_copy().
Ralph Corderoy [Thu, 20 Apr 2017 13:27:46 +0000 (14:27 +0100)]
uip/dropsbr.c: Fix buffer overrun in mbx_copy().

The overrun occurs frequently, but typically zeroes a byte of a
character pointer on the stack that's not yet been used.
Caused by 28610ff9a604a75ae0c383be03aa19415ddb1965 appending a NUL after
the bytes stored by read(2).

9 years agoh/mime.h: Delete unused isatom(c) macro.
Ralph Corderoy [Tue, 18 Apr 2017 14:37:54 +0000 (15:37 +0100)]
h/mime.h: Delete unused isatom(c) macro.

9 years agoman/*.man: Fix some multi-word .B invocations.
Ralph Corderoy [Tue, 18 Apr 2017 11:54:28 +0000 (12:54 +0100)]
man/*.man: Fix some multi-word .B invocations.

Some needed to be .B for the first word, but .I for the second, or just
plain text for the rest of the words that should be on their own line.
Others were just plain wrong and became .IR for a man-page reference.
Then the .TP macro uses an input trap so only a single following line of
source is used and this prevents a two-line `.B .I', so use embedded
font escapes instead.

9 years agoman/*.man: Use italic for emphasis, not bold or SHOUTING.
Ralph Corderoy [Tue, 18 Apr 2017 00:14:57 +0000 (01:14 +0100)]
man/*.man: Use italic for emphasis, not bold or SHOUTING.

When reading a body of text, italic is sufficient to add emphasis to
what's already being read.  Bold draws the eye to the word on the page
and is more useful for keywords, concepts, etc.  Some `.B' remain that
should probably be `.I', but they looked to have other problems so I
left them out of this pass.

9 years agoREADME.manpages: `user ID', not `user-id'.
Ralph Corderoy [Mon, 17 Apr 2017 23:27:35 +0000 (00:27 +0100)]
README.manpages: `user ID', not `user-id'.

9 years agoman/*.man: Replace minus sign with hyphen: `\-' with `-'.
Ralph Corderoy [Mon, 17 Apr 2017 23:24:07 +0000 (00:24 +0100)]
man/*.man: Replace minus sign with hyphen: `\-' with `-'.

Conservatively changed many of the troff minus-signs, `\-', with a troff
hyphen, `-'.  Where it wasn't quickly obviously, I left it unchanged.
There were also cases that shouldn't be either minus sign or hyphen.
Those were changed to hyphen and still need to be fixed properly.

9 years agoREADME.manpages: It's a `From header', not a `From: header'.
Ralph Corderoy [Mon, 17 Apr 2017 22:36:28 +0000 (23:36 +0100)]
README.manpages: It's a `From header', not a `From: header'.

9 years agoUse stat(3) instead of lstat(3), to dereference symbolic links.
David Levine [Mon, 17 Apr 2017 22:06:05 +0000 (18:06 -0400)]
Use stat(3) instead of lstat(3), to dereference symbolic links.

Fix to commit 4318012376e06229307c0ed4f62a00faae9edc63.

9 years agoDon't ignore bit 5 of a char when comparing alias names.
Ralph Corderoy [Mon, 17 Apr 2017 13:53:28 +0000 (14:53 +0100)]
Don't ignore bit 5 of a char when comparing alias names.

It's a crude method of ignoring case, but makes `^' equal to `~'.
Use tolower(3) instead.
http://lists.nongnu.org/archive/html/nmh-workers/2017-03/msg00050.html

9 years agoman/mh-profile.man: Note MHTMPDIR is deprecated.
Ralph Corderoy [Mon, 17 Apr 2017 13:34:14 +0000 (14:34 +0100)]
man/mh-profile.man: Note MHTMPDIR is deprecated.

In future, only TMPDIR and /tmp will be used, e.g. not `mhpath +'.