]> diplodocus.org Git - nmh/log
nmh
8 years agogetpass.c: Don't fileno(NULL) when fopen("/dev/tty") fails.
Ralph Corderoy [Thu, 7 Sep 2017 09:16:36 +0000 (10:16 +0100)]
getpass.c: Don't fileno(NULL) when fopen("/dev/tty") fails.

If stdin is a TTY, but opening it for writing fails, then stdin and
stderr are used as defaults and the TTY doesn't have echo disabled.  The
later test to restore echo just checks if stdin is a TTY and not that it
was opened successfully causing a NULL FILE pointer to be fileno(3)'d.
Fixes da6af9633.  This function's logic remains a bit contorted;  I went
for the minimal fix.

8 years agomhbuildsbr.c: Don't free(3) string then print it; do reverse.
Ralph Corderoy [Thu, 7 Sep 2017 09:03:25 +0000 (10:03 +0100)]
mhbuildsbr.c: Don't free(3) string then print it; do reverse.

Fixes c87ca5cca.

8 years agosmtp.c: Use read-end of pipe, not random integer.
Ralph Corderoy [Thu, 7 Sep 2017 08:57:11 +0000 (09:57 +0100)]
smtp.c: Use read-end of pipe, not random integer.

Instead of `pdi[0]' the array of two elements was being indexed by `i'.
That is typically zero so everything works, but can be up to five
depending how many times fork(2) failed before succeeding.  Fixes
e65127948.

8 years agoRevised expected output with -prefer in test/mhlist/test-mhlist.
David Levine [Tue, 5 Sep 2017 14:51:00 +0000 (10:51 -0400)]
Revised expected output with -prefer in test/mhlist/test-mhlist.

Update to commit 5dce1b38ace6cf61398df3ee4ca5aee0e1dedb5d.

8 years agoman: Fix some of the font-changing macros' parameters.
Ralph Corderoy [Tue, 5 Sep 2017 13:11:56 +0000 (14:11 +0100)]
man: Fix some of the font-changing macros' parameters.

Various recurring problems on two themes.  `.BR foo,' lacks the space in
`.BR foo ,'.  `.IR foo' doesn't need to alternate and can be just `.I
foo'.  Other similar changes made, e.g. `.B foo' becoming `foo'.

8 years agoAdd -noprefer switch to mhshow, mhstore, and mhlist
Paul Fox [Sat, 2 Sep 2017 15:24:01 +0000 (11:24 -0400)]
Add -noprefer switch to mhshow, mhstore, and mhlist

Allow profile-specified -prefer switches to be cancelled from the
command line.

8 years agoChange the priority ordering for multiple -prefer switches
Paul Fox [Sat, 2 Sep 2017 13:13:44 +0000 (09:13 -0400)]
Change the priority ordering for multiple -prefer switches

Interpreting multiple -prefer switches in ascending priority
order allows the command line to override the user's profile.

8 years agoman: Use `.IR' for `foo(1)', not the few `.BR'.
Ralph Corderoy [Mon, 4 Sep 2017 11:01:35 +0000 (12:01 +0100)]
man: Use `.IR' for `foo(1)', not the few `.BR'.

8 years agoman: Change the tautological `the foo(1) man page' to `foo(1)'.
Ralph Corderoy [Mon, 4 Sep 2017 10:59:48 +0000 (11:59 +0100)]
man: Change the tautological `the foo(1) man page' to `foo(1)'.

8 years agooauth: Replace `if...return false; return true' with `return ...'.
Ralph Corderoy [Mon, 4 Sep 2017 09:42:17 +0000 (10:42 +0100)]
oauth: Replace `if...return false; return true' with `return ...'.

In functions returning bool, these are equivalent.

    Before:                 After:
        if (!foo())             return foo();
            return false;
        return true;

8 years agooauth.c: Remove unused assignments of function return value.
Ralph Corderoy [Mon, 4 Sep 2017 09:29:21 +0000 (10:29 +0100)]
oauth.c: Remove unused assignments of function return value.

`if ((status = foo()) != OK) return false;' doesn't need to set local
variable status.

8 years agoReplace FALSE and TRUE with C99's false and true.
Ralph Corderoy [Mon, 4 Sep 2017 09:07:35 +0000 (10:07 +0100)]
Replace FALSE and TRUE with C99's false and true.

Remove the duplicate definitions of FALSE and TRUE.  Change a few
variables from int to bool at the same time.  The semantics of bool are
different to int because `bool b = 42' maps 42 to 1, but if the code was
relying on that then it needs shaking out anyway.

8 years agoprint_intro(): Change parameter brief from int to bool.
Ralph Corderoy [Mon, 4 Sep 2017 09:03:36 +0000 (10:03 +0100)]
print_intro(): Change parameter brief from int to bool.

8 years agoflist.c: Use bool instead of int for some of the flags.
Ralph Corderoy [Sun, 3 Sep 2017 22:37:52 +0000 (23:37 +0100)]
flist.c: Use bool instead of int for some of the flags.

8 years agoReplace boolean with bool everywhere.
Ralph Corderoy [Sun, 3 Sep 2017 22:29:36 +0000 (23:29 +0100)]
Replace boolean with bool everywhere.

boolean's comment said it existed to ensure storage was a char and not
an int so it could be packed in a struct, but the only struct using it
doesn't care about the space taken.

8 years agomh.h: Always define NMH_UNUSED as a cast to void.
Ralph Corderoy [Sun, 3 Sep 2017 14:41:04 +0000 (15:41 +0100)]
mh.h: Always define NMH_UNUSED as a cast to void.

The not-gcc-or-earlier-than-gcc-2 version was the identity function
seems unnecessary as what C99 compiler would complain about a cast to
void?

8 years agomh.h: Move the gcc-4.3-conditional macro definitions.
Ralph Corderoy [Sun, 3 Sep 2017 14:38:44 +0000 (15:38 +0100)]
mh.h: Move the gcc-4.3-conditional macro definitions.

Having them outside of the gcc-2 ones makes the logic easier to follow
as there's no nesting.

8 years agodropsbr.c: Remove unused ntohl() macro, and its NTOHLSWAP test.
Ralph Corderoy [Sun, 3 Sep 2017 12:35:34 +0000 (13:35 +0100)]
dropsbr.c: Remove unused ntohl() macro, and its NTOHLSWAP test.

Not used since e6c91771 removed support for ./.foo.map index for ./foo
mailbox.

8 years agofakehttp.c: Remove unused LINESIZE macro; never used.
Ralph Corderoy [Sun, 3 Sep 2017 12:32:24 +0000 (13:32 +0100)]
fakehttp.c: Remove unused LINESIZE macro; never used.

8 years agoconfig.c: Remove unused nmhdocdir() macro.
Ralph Corderoy [Sun, 3 Sep 2017 12:30:34 +0000 (13:30 +0100)]
config.c: Remove unused nmhdocdir() macro.

8 years agoap.c, dp.c: exit(3) with 0 or 1, not [0, MAX_EXIT].
Ralph Corderoy [Sun, 3 Sep 2017 11:23:14 +0000 (12:23 +0100)]
ap.c, dp.c: exit(3) with 0 or 1, not [0, MAX_EXIT].

Don't attempt to indicate the number of failures through the exit status
as that's too constrained.  Just stick to zero for none, and 1 for some.
Delete, the now unused, MAX_EXIT.

8 years agoDEFAULT_PAGER: Move from nmh.h to mh.h. Former is "config.h".
Ralph Corderoy [Sun, 3 Sep 2017 11:18:59 +0000 (12:18 +0100)]
DEFAULT_PAGER: Move from nmh.h to mh.h.  Former is "config.h".

The macro isn't related to platform independence, unlike the rest of
nmh.h, that starts by including config.h.

8 years agogeteditor.c: Hard-code the default, "vi".
Ralph Corderoy [Sat, 2 Sep 2017 23:22:18 +0000 (00:22 +0100)]
geteditor.c: Hard-code the default, "vi".

It was the only use of the DEFAULT_EDITOR macro, so that can be deleted.

8 years agoMove base64.c's prototypes from prototypes.h to new base64.h.
Ralph Corderoy [Sat, 2 Sep 2017 17:49:11 +0000 (18:49 +0100)]
Move base64.c's prototypes from prototypes.h to new base64.h.

8 years agomhbuild.man: Fix grammar indentation by expanding tabs.
Ralph Corderoy [Sat, 2 Sep 2017 16:38:33 +0000 (17:38 +0100)]
mhbuild.man: Fix grammar indentation by expanding tabs.

The grammar is pre-formatted using spaces for indentation.
A few lines had switched to tabs in 9b706433f.

8 years agodecodeBase64(): Limit length of error message on invalid input.
Ralph Corderoy [Sat, 2 Sep 2017 12:55:29 +0000 (13:55 +0100)]
decodeBase64(): Limit length of error message on invalid input.

Screenfuls of email were appearing on stderr.

8 years agoRestrict use of alloc_size function attribute to gcc >= 4.3.0.
David Levine [Tue, 29 Aug 2017 01:03:21 +0000 (21:03 -0400)]
Restrict use of alloc_size function attribute to gcc >= 4.3.0.

It's not supported by gcc 4.2.4.  CHECK_PRINTF doesn't work
perfectly with gcc 4.2.1, so disable that with gcc < 4.3.0 as
well. Fix to commit c066b395274021182a5f0530ccfeb1bcd167d860.

8 years agoMove read_line.c's prototypes from prototypes.h to new read_line.h.
Ralph Corderoy [Mon, 28 Aug 2017 18:57:16 +0000 (19:57 +0100)]
Move read_line.c's prototypes from prototypes.h to new read_line.h.

Add copyright comment to start of read_line.c whilst there.

8 years agoAdd ENDNULL macro for gcc's `sentinel' function attribute.
Ralph Corderoy [Mon, 28 Aug 2017 18:47:23 +0000 (19:47 +0100)]
Add ENDNULL macro for gcc's `sentinel' function attribute.

Annotate a few prototypes with it.

8 years agoMove terminal.c's prototypes from prototypes.h to new terminal.h.
Ralph Corderoy [Mon, 28 Aug 2017 18:33:53 +0000 (19:33 +0100)]
Move terminal.c's prototypes from prototypes.h to new terminal.h.

8 years agoFix spelling in comment.
Ralph Corderoy [Mon, 28 Aug 2017 17:13:17 +0000 (18:13 +0100)]
Fix spelling in comment.

8 years agoread_switch_multiword.c: siglongjmp(3) removes need for `else'.
Ralph Corderoy [Mon, 28 Aug 2017 17:09:59 +0000 (18:09 +0100)]
read_switch_multiword.c: siglongjmp(3) removes need for `else'.

8 years agomhlsbr.c: Don't need to `else' after longjmp() at end of then-block.
Ralph Corderoy [Mon, 28 Aug 2017 17:08:31 +0000 (18:08 +0100)]
mhlsbr.c: Don't need to `else' after longjmp() at end of then-block.

8 years agoRemove comment asking if siglongjmp(3) should be used; it is.
Ralph Corderoy [Mon, 28 Aug 2017 17:05:41 +0000 (18:05 +0100)]
Remove comment asking if siglongjmp(3) should be used;  it is.

77a8a873b switched from longjmp(3).

8 years agoDon't need to `else' after mhladios() at end of then-block.
Ralph Corderoy [Mon, 28 Aug 2017 17:00:11 +0000 (18:00 +0100)]
Don't need to `else' after mhladios() at end of then-block.

8 years agoGive mhldone() and mhladios() the NORETURN function attribute.
Ralph Corderoy [Mon, 28 Aug 2017 16:57:04 +0000 (17:57 +0100)]
Give mhldone() and mhladios() the NORETURN function attribute.

And remove `FALLTHRU' comments after their calls.

8 years agoDon't cast zero to pid_t for setpgid(2)'s first argument.
Ralph Corderoy [Mon, 28 Aug 2017 16:53:15 +0000 (17:53 +0100)]
Don't cast zero to pid_t for setpgid(2)'s first argument.

8 years agoDon't cast zero to char for storing at pointer to char.
Ralph Corderoy [Mon, 28 Aug 2017 16:52:12 +0000 (17:52 +0100)]
Don't cast zero to char for storing at pointer to char.

8 years agoDon't cast zero to a non-function pointer; use NULL instead.
Ralph Corderoy [Mon, 28 Aug 2017 16:49:29 +0000 (17:49 +0100)]
Don't cast zero to a non-function pointer;  use NULL instead.

Better still, omit it when BSS does the job, or C's treatment of
non-zero as true is sufficient.

8 years agomhparse: Change mhfixmsg flags from int to bool.
Ralph Corderoy [Mon, 28 Aug 2017 13:45:16 +0000 (14:45 +0100)]
mhparse: Change mhfixmsg flags from int to bool.

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.