]> diplodocus.org Git - nmh/log
nmh
8 years agomhparse.h: Add externs for skip_mp_cte_check, etc.
Ralph Corderoy [Mon, 28 Aug 2017 13:35:15 +0000 (14:35 +0100)]
mhparse.h: Add externs for skip_mp_cte_check, etc.

Delete the local copies from the other user.

8 years agoDelete declaration already available from included header file.
Ralph Corderoy [Mon, 28 Aug 2017 13:34:44 +0000 (14:34 +0100)]
Delete declaration already available from included header file.

8 years agomhparse.h: Add externs for preferred_types[], etc.
Ralph Corderoy [Mon, 28 Aug 2017 13:25:11 +0000 (14:25 +0100)]
mhparse.h: Add externs for preferred_types[], etc.

Delete the local copies from other users.

8 years agoDelete declarations already available from included header files.
Ralph Corderoy [Mon, 28 Aug 2017 13:16:51 +0000 (14:16 +0100)]
Delete declarations already available from included header files.

8 years agomhbuildsbr.c: Include mhcachesbr.h. Delete copy of prototype.
Ralph Corderoy [Mon, 28 Aug 2017 12:52:48 +0000 (13:52 +0100)]
mhbuildsbr.c: Include mhcachesbr.h.  Delete copy of prototype.

8 years agomhfixmsg.c: Make mhfixmsgsbr() static.
Ralph Corderoy [Mon, 28 Aug 2017 12:50:41 +0000 (13:50 +0100)]
mhfixmsg.c: Make mhfixmsgsbr() static.

8 years agoMove NPARTS and NTYPES from mhparse.h to mhmisc.h.
Ralph Corderoy [Mon, 28 Aug 2017 12:37:24 +0000 (13:37 +0100)]
Move NPARTS and NTYPES from mhparse.h to mhmisc.h.

It's mhmisc.c that has the global arrays that use them.

8 years agomhmisc.h: Add mhmisc.c's global variables as externs.
Ralph Corderoy [Mon, 28 Aug 2017 12:32:38 +0000 (13:32 +0100)]
mhmisc.h: Add mhmisc.c's global variables as externs.

Delete the local copies from other users.

8 years agoCreate mhmisc.h with mhmisc.c's global-function prototypes.
Ralph Corderoy [Mon, 28 Aug 2017 12:25:53 +0000 (13:25 +0100)]
Create mhmisc.h with mhmisc.c's global-function prototypes.

Delete the many local copies from each caller.

8 years agoMake functions with no external callers by name static.
Ralph Corderoy [Mon, 28 Aug 2017 12:08:34 +0000 (13:08 +0100)]
Make functions with no external callers by name static.

8 years agorcvtty.c: Remove duplicate prototype. Other in mts.h.
Ralph Corderoy [Mon, 28 Aug 2017 11:47:38 +0000 (12:47 +0100)]
rcvtty.c: Remove duplicate prototype.  Other in mts.h.

8 years agoaliasbr.c: Remove duplicate prototypes. Others in aliasbr.h.
Ralph Corderoy [Mon, 28 Aug 2017 11:45:32 +0000 (12:45 +0100)]
aliasbr.c: Remove duplicate prototypes.  Others in aliasbr.h.

8 years agomhparam: exit(3) zero if all components found, else one.
Ralph Corderoy [Sun, 27 Aug 2017 19:04:42 +0000 (20:04 +0100)]
mhparam: exit(3) zero if all components found, else one.

The exit status used to be a count of the number missing, clipped to
120.  That doesn't seem useful, and is overhead to document, read, and
test.  Use the normal Unix 0 or 1 instead.

8 years agoEnsure that mhfixmsg exit status is either 0 or 1.
David Levine [Sun, 27 Aug 2017 13:25:21 +0000 (09:25 -0400)]
Ensure that mhfixmsg exit status is either 0 or 1.

Ralph noticed where exit status values were being accumulated, and those
values could include -1.

8 years agoAdd gcc's pure function attribute.
Ralph Corderoy [Sun, 27 Aug 2017 13:08:22 +0000 (14:08 +0100)]
Add gcc's pure function attribute.

Mark quite a few function prototypes with it.

8 years agoinc.c: Make maildir_srt() static.
Ralph Corderoy [Sun, 27 Aug 2017 12:52:46 +0000 (13:52 +0100)]
inc.c: Make maildir_srt() static.

8 years agoReplace add(foo, NULL) with mh_xstrdup(foo).
Ralph Corderoy [Sun, 27 Aug 2017 11:13:39 +0000 (12:13 +0100)]
Replace add(foo, NULL) with mh_xstrdup(foo).

add()'s arguments are back to front so add(foo, bar) produces bar+foo in
the normal case.  Thus add(foo, NULL) is read as the jarring NULL+foo.
Removing the NULL with mh_xstrdup() avoids this.  FENDNULL is used when
it isn't obvious foo can't be NULL as add() treats it as "" in that
case.

8 years agoReplace strlen("foo") with LEN("foo").
Ralph Corderoy [Sun, 27 Aug 2017 10:53:26 +0000 (11:53 +0100)]
Replace strlen("foo") with LEN("foo").

The existing LEN() uses sizeof.

8 years agocontext_find.c: Hoist strlen(3) out of search loop.
Ralph Corderoy [Sun, 27 Aug 2017 10:47:02 +0000 (11:47 +0100)]
context_find.c: Hoist strlen(3) out of search loop.

8 years agoAdd die(fmt, ...). Equivalent to adios(NULL, fmt, ...).
Ralph Corderoy [Sun, 27 Aug 2017 10:34:50 +0000 (11:34 +0100)]
Add die(fmt, ...).  Equivalent to adios(NULL, fmt, ...).

Avoids the noise of the `NULL' first parameter that's used in over 70%
of adios() calls.  Removes the possibility of it being omitted and `fmt'
being used instead.  `die' is already in use in nmh's shell scripts.
Had to rename post.c's existing die() to avoid it clashing.

8 years agomhparam: Remove `libdir', deprecated in 1.7.
Ralph Corderoy [Sun, 27 Aug 2017 09:49:10 +0000 (10:49 +0100)]
mhparam: Remove `libdir', deprecated in 1.7.

Use existing `libexecdir' instead.

8 years agopick: Remove support for MHPDEBUG environment variable.
Ralph Corderoy [Sun, 27 Aug 2017 09:39:11 +0000 (10:39 +0100)]
pick: Remove support for MHPDEBUG environment variable.

It was deprecated in 1.7, and the -debug option gives the same
behaviour.

8 years agoAdd MAX_EXIT, value 120, to limit some more exit(3) values.
Ralph Corderoy [Sun, 27 Aug 2017 09:16:11 +0000 (10:16 +0100)]
Add MAX_EXIT, value 120, to limit some more exit(3) values.

mhparam(1) altered to use new macro.  ap(1) and dp(1) now limit.

8 years agomh_xmalloc() et al: Use C99's `%zu' to print size_t.
Ralph Corderoy [Sat, 26 Aug 2017 21:40:40 +0000 (22:40 +0100)]
mh_xmalloc() et al: Use C99's `%zu' to print size_t.

8 years agoTreat %(myhost) failure to match canonical hostname as information.
David Levine [Sat, 26 Aug 2017 20:06:52 +0000 (16:06 -0400)]
Treat %(myhost) failure to match canonical hostname as information.

Not an error from test-myhost.

8 years agoReplace printf("foo\n") with puts("foo").
Ralph Corderoy [Sat, 26 Aug 2017 18:24:05 +0000 (19:24 +0100)]
Replace printf("foo\n") with puts("foo").

8 years agoAdd gcc's nonnull function attribute.
Ralph Corderoy [Sat, 26 Aug 2017 18:19:16 +0000 (19:19 +0100)]
Add gcc's nonnull function attribute.

Apply it to some prototypes to get started.

8 years agoUse C99's variable-argument preprocessor macros for ALLOC_SIZE.
Ralph Corderoy [Sat, 26 Aug 2017 17:41:42 +0000 (18:41 +0100)]
Use C99's variable-argument preprocessor macros for ALLOC_SIZE.

ALLOC_SIZE2() can be deleted.

8 years agoAdd gcc's malloc function attribute.
Ralph Corderoy [Sat, 26 Aug 2017 17:15:21 +0000 (18:15 +0100)]
Add gcc's malloc function attribute.

Mark wrappers for malloc(3), strdup(3), etc.

8 years agofmt_rfc2047.c: Tables hexindex[] and index_64[] can be const.
Ralph Corderoy [Sat, 26 Aug 2017 17:02:59 +0000 (18:02 +0100)]
fmt_rfc2047.c: Tables hexindex[] and index_64[] can be const.

8 years agoAdd gcc's const function attribute.
Ralph Corderoy [Sat, 26 Aug 2017 16:36:31 +0000 (17:36 +0100)]
Add gcc's const function attribute.

8 years agoAdd gcc's alloc_size function attribute.
Ralph Corderoy [Sat, 26 Aug 2017 16:29:08 +0000 (17:29 +0100)]
Add gcc's alloc_size function attribute.

Used for malloc-wrapper, etc.

8 years agoAdd more NORETURN and CHECK_PRINTF function attributes.
Ralph Corderoy [Sat, 26 Aug 2017 14:01:35 +0000 (15:01 +0100)]
Add more NORETURN and CHECK_PRINTF function attributes.

And fix the errors that the compiler then detects.

8 years agoChanged failure exit status of mkstemp(1) from 255 to 1.
David Levine [Sat, 26 Aug 2017 11:30:30 +0000 (07:30 -0400)]
Changed failure exit status of mkstemp(1) from 255 to 1.

For consistency, on Ralph's suggestion.

8 years agoforw.man, mh-mime.man: Add missing commas in `SEE ALSO' list.
Ralph Corderoy [Sat, 26 Aug 2017 10:51:06 +0000 (11:51 +0100)]
forw.man, mh-mime.man: Add missing commas in `SEE ALSO' list.

Inspired by 6db45651.

8 years agopicksbr.c: Specify parameters of nexus's n_action function pointer.
Ralph Corderoy [Fri, 25 Aug 2017 21:43:46 +0000 (22:43 +0100)]
picksbr.c: Specify parameters of nexus's n_action function pointer.

Omitting them is obsolescent by modern C standards.

8 years agoPrint pointers in debug with C99's `%p' rather than `0x%x'.
Ralph Corderoy [Fri, 25 Aug 2017 21:36:01 +0000 (22:36 +0100)]
Print pointers in debug with C99's `%p' rather than `0x%x'.

The `%x' needed a double cast, the `%p' needs just a single to void
pointer.  The output can differ, e.g. `0x0' v. perhaps
implementation-defined `(nil)'.

8 years agopicksbr.c: fprintf function pointer with unsigned-long-long cast.
Ralph Corderoy [Fri, 25 Aug 2017 21:20:17 +0000 (22:20 +0100)]
picksbr.c: fprintf function pointer with unsigned-long-long cast.

It was previously a double cast, to unsigned long, and then to unsigned
int, and formatted with `0x%x'.  Now we're C99, at least, we can use
unsigned long long and `%#llx'.  Though the fprintf() in question should
be a BUG() that abort(3)s.

8 years agoFixed extra and missing trailing commas in SEE ALSO sections of man pages.
David Levine [Fri, 25 Aug 2017 23:35:55 +0000 (19:35 -0400)]
Fixed extra and missing trailing commas in SEE ALSO sections of man pages.

8 years agobuild_nmh: Stop -d enabling assert(3)s.
Ralph Corderoy [Fri, 25 Aug 2017 08:45:00 +0000 (09:45 +0100)]
build_nmh: Stop -d enabling assert(3)s.

c347c3bb enabled asserts by default so alter -d's description to not say
it enables them as this may make users thing that have to disable
optimisation, -d's other action, to get them.  Don't add
`--enable-assert' to configure's options.

8 years agoFormat with `%#x' instead of `0x%x' if difference matters not.
Ralph Corderoy [Thu, 24 Aug 2017 19:09:00 +0000 (20:09 +0100)]
Format with `%#x' instead of `0x%x' if difference matters not.

Zero formats as `0' rather than `0x0', but that doesn't matter in debug
output, or an error message about a byte's value to the user.

8 years agomhlist -verbose: Don't duplicate message/external-body's parameters.
Ralph Corderoy [Thu, 24 Aug 2017 15:03:44 +0000 (16:03 +0100)]
mhlist -verbose: Don't duplicate message/external-body's parameters.

The test of eb_flags remains, and since the old code used to insist
eb_access, `access-type', was set, the new code adds a note if it's
missing.

8 years agomhparse.c: Correct comment; si_val is the `anonymous' Boolean.
Ralph Corderoy [Thu, 24 Aug 2017 14:56:06 +0000 (15:56 +0100)]
mhparse.c: Correct comment; si_val is the `anonymous' Boolean.

8 years agomhlist -debug: Print FILE pointers with `%p', not `%#x'.
Ralph Corderoy [Thu, 24 Aug 2017 12:18:01 +0000 (13:18 +0100)]
mhlist -debug: Print FILE pointers with `%p', not `%#x'.

Removes the double casting.

8 years agomhbuildsbr.c: Ensure temporary FILE closed regardless of success.
Ralph Corderoy [Wed, 23 Aug 2017 22:38:50 +0000 (23:38 +0100)]
mhbuildsbr.c: Ensure temporary FILE closed regardless of success.

If the fopen() succeeded, but the fwrite() failed, then the FILE wasn't
fclose()'d.

8 years agomhbuildsbr.c: Flip logic, moving goto to then-block; no need for else.
Ralph Corderoy [Wed, 23 Aug 2017 21:50:33 +0000 (22:50 +0100)]
mhbuildsbr.c: Flip logic, moving goto to then-block;  no need for else.

Also makes more clear a FILE pointer that's probably not fclose()'d.

8 years agoFlip logic, moving goto from else- to then-block.
Ralph Corderoy [Wed, 23 Aug 2017 21:16:32 +0000 (22:16 +0100)]
Flip logic, moving goto from else- to then-block.

Thus removing the need for the `else'.

8 years agoDon't need to `else' after done() at end of then-block.
Ralph Corderoy [Wed, 23 Aug 2017 21:11:49 +0000 (22:11 +0100)]
Don't need to `else' after done() at end of then-block.

8 years agoDon't need to `else' after adios() at end of then-block.
Ralph Corderoy [Wed, 23 Aug 2017 21:04:42 +0000 (22:04 +0100)]
Don't need to `else' after adios() at end of then-block.

Only true of simple if-else rather than a chain.

8 years agosh scripts: Remove `else' after exit at end of then-block.
Ralph Corderoy [Wed, 23 Aug 2017 20:39:59 +0000 (21:39 +0100)]
sh scripts: Remove `else' after exit at end of then-block.

Only for simple if-then-else-fi with no elif.

8 years agouip/rcvtty.c: Flip logic, moving `return' to then-block.
Ralph Corderoy [Wed, 23 Aug 2017 20:38:55 +0000 (21:38 +0100)]
uip/rcvtty.c: Flip logic, moving `return' to then-block.

There's then no need for an `else' around the old then-block.

    Before          After
    if (foo)        if (!foo)
        bar();          xyzzy();
    else                return;
        xyzzy();    bar();
        return;

8 years agoRemove the `else' after a simple if-then block ending in `break'.
Ralph Corderoy [Wed, 23 Aug 2017 20:25:52 +0000 (21:25 +0100)]
Remove the `else' after a simple if-then block ending in `break'.

    Before          After
    if (foo)        if (foo)
        break;          break;
    else            bar();
        bar();

8 years agomhlistsbr.c: Replace list_application() with body at call site.
Ralph Corderoy [Wed, 23 Aug 2017 20:20:25 +0000 (21:20 +0100)]
mhlistsbr.c: Replace list_application() with body at call site.

list_application()'s comment said the function didn't need to exist.
It's correct, so delete it.  The sole caller now calls list_content(),
as list_application() used to do.  That's actually the same as other
cases in the switch so merge them.  There is a slight difference:
list_application() used to call list_content() and then return OK
regardless, now it returns list_content()'s value, but that's always OK
too.

8 years agomhmail: Turn sh's else-if into elif.
Ralph Corderoy [Tue, 22 Aug 2017 23:22:58 +0000 (00:22 +0100)]
mhmail: Turn sh's else-if into elif.

8 years agoJoin the lines of another couple of `else if'.
Ralph Corderoy [Tue, 22 Aug 2017 23:17:22 +0000 (00:17 +0100)]
Join the lines of another couple of `else if'.

It's misleading to have them on separate lines, especially when there's
a blank line in between.

8 years agoMake sure we return the descriptor from the file handle. Noted by
Ken Hornstein [Wed, 23 Aug 2017 16:08:24 +0000 (12:08 -0400)]
Make sure we return the descriptor from the file handle.  Noted by
Ralph Corderoy.

8 years agoReformat else-if that are split over two or more lines into one.
Ralph Corderoy [Mon, 21 Aug 2017 14:02:51 +0000 (15:02 +0100)]
Reformat else-if that are split over two or more lines into one.

No functional change intended.

8 years agoConvert some Boolean variables to the bool type.
Ralph Corderoy [Mon, 21 Aug 2017 13:44:19 +0000 (14:44 +0100)]
Convert some Boolean variables to the bool type.

8 years agoConvert some Boolean variables to the bool type.
Ralph Corderoy [Mon, 21 Aug 2017 11:06:40 +0000 (12:06 +0100)]
Convert some Boolean variables to the bool type.

8 years agoAdd ZERO(p) for the typical memset(p, 0, sizeof *p) dance.
Ralph Corderoy [Mon, 21 Aug 2017 10:09:02 +0000 (11:09 +0100)]
Add ZERO(p) for the typical memset(p, 0, sizeof *p) dance.

Also seen as memset(&foo->bar_xyzzy, 0, sizeof foo->bar_xyzzy).  I find
it tedious to keep checking the parameters are in agreement when reading
the code.

8 years agoRemoved conditional addition of -D_FORTIFY_SOURCE=2 from CPPFLAGS.
David Levine [Mon, 21 Aug 2017 20:44:07 +0000 (16:44 -0400)]
Removed conditional addition of -D_FORTIFY_SOURCE=2 from CPPFLAGS.

And added to CFLAGS in build_nmh.

8 years agoman: Vet the NAME sections, especially mhfixmsg's.
Ralph Corderoy [Sun, 20 Aug 2017 13:59:26 +0000 (14:59 +0100)]
man: Vet the NAME sections, especially mhfixmsg's.

Don't limit mhfixmsg to fixing "nmh MIME" emails.

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.