]> diplodocus.org Git - nmh/log
nmh
8 years agoerror.c: Move interface to own file.
Ralph Corderoy [Thu, 2 Nov 2017 13:44:24 +0000 (13:44 +0000)]
error.c: Move interface to own file.

8 years agoSupport a -timeout switch.
Ken Hornstein [Thu, 9 Nov 2017 03:32:57 +0000 (22:32 -0500)]
Support a -timeout switch.

8 years agoUse va_copy() to get a copy of va_list, instead of using original.
Ken Hornstein [Sat, 4 Nov 2017 13:59:18 +0000 (09:59 -0400)]
Use va_copy() to get a copy of va_list, instead of using original.

netsec_vprintf() can call vsnprintf() twice if the outgoing buffer is
full (but it happens rarely in practice, given the way the current
code uses it).  But if this DOES happen, vsnprintf() will use the
same va_list argument twice, and the second time around either it will
grab a random bit of memory off of the stack OR it will segfault.
So we always use va_copy() to get our own copy of the passed-in va_list
and work on that.

8 years agoAdd support for batch mode.
Ken Hornstein [Sat, 4 Nov 2017 13:58:16 +0000 (09:58 -0400)]
Add support for batch mode.

Add a new switch, -batch, which will run a sequence of commands out
of a batch file.

8 years agoVarious IMAP protocol improvements
Ken Hornstein [Fri, 3 Nov 2017 18:58:06 +0000 (14:58 -0400)]
Various IMAP protocol improvements

Make the CAPABAILITY parser work correctly (and not include CAPABILITY
as a capability).

Support reading an untagged CAPABILITY response during an authentication
exchange.

Removing some debugging statements.

Make LITERAL+ and LITERAL- work correctly.

8 years agoMake APPEND work; still needs some changes, though.
Ken Hornstein [Fri, 3 Nov 2017 03:21:36 +0000 (23:21 -0400)]
Make APPEND work; still needs some changes, though.

8 years agoStart of making APPEND functional; not quite there yet.
Ken Hornstein [Thu, 2 Nov 2017 03:46:17 +0000 (23:46 -0400)]
Start of making APPEND functional; not quite there yet.

8 years agoSupport sending multiple commands at once.
Ken Hornstein [Wed, 1 Nov 2017 19:01:23 +0000 (15:01 -0400)]
Support sending multiple commands at once.

8 years agoReport on the TLS negotation time
Ken Hornstein [Wed, 1 Nov 2017 18:00:18 +0000 (14:00 -0400)]
Report on the TLS negotation time

8 years agoprototypes.h: Delete duplicate prototypes.
Ralph Corderoy [Thu, 2 Nov 2017 02:21:55 +0000 (02:21 +0000)]
prototypes.h: Delete duplicate prototypes.

Those that already appear in other header files.

8 years agoprototypes.h: Delete default_done() prototype.
Ralph Corderoy [Thu, 2 Nov 2017 02:20:12 +0000 (02:20 +0000)]
prototypes.h: Delete default_done() prototype.

Function doesn't exist;  removed in 38615191.

8 years agoforwsbr.c: Move interface declaration to own forwsbr.h.
Ralph Corderoy [Thu, 2 Nov 2017 01:58:09 +0000 (01:58 +0000)]
forwsbr.c: Move interface declaration to own forwsbr.h.

8 years agomd5.c, md5.h: Reformat and delete needless portability.
Ralph Corderoy [Thu, 2 Nov 2017 01:46:26 +0000 (01:46 +0000)]
md5.c, md5.h: Reformat and delete needless portability.

The algorithm is not going to change, bugs are unlikely to appear in the
upstream RSA version, so reformat the source to be more readable, and
delete portability code now we have function prototypes with parameters,
void pointer, etc.

8 years agoSplit function definition prototypes so identifier starts a line.
Ralph Corderoy [Thu, 2 Nov 2017 01:21:56 +0000 (01:21 +0000)]
Split function definition prototypes so identifier starts a line.

Nearly all were already split like this.  The consistency helps ad hoc
scripting.

8 years agoDon't have `static' of a function definition on its own line.
Ralph Corderoy [Thu, 2 Nov 2017 01:12:17 +0000 (01:12 +0000)]
Don't have `static' of a function definition on its own line.

Join it to the next line that species the return type.

8 years agoMove the opening brace of a C function to its own line.
Ralph Corderoy [Thu, 2 Nov 2017 01:09:32 +0000 (01:09 +0000)]
Move the opening brace of a C function to its own line.

If the brace doesn't start a line of its own then vi(1)'s
function-related commands don't spot the function.

8 years agorepl.c: Add `static' to function definitions to match declarations.
Ralph Corderoy [Thu, 2 Nov 2017 00:50:51 +0000 (00:50 +0000)]
repl.c: Add `static' to function definitions to match declarations.

8 years agorepl.c, replsbr.c: Move shared data into header file.
Ralph Corderoy [Thu, 2 Nov 2017 00:34:18 +0000 (00:34 +0000)]
repl.c, replsbr.c: Move shared data into header file.

repl.c declared global variables, and replsbr.c had extern statements
that hopefully matched them.  But they're really inputs into replsbr.c's
code, so move the declarations into a new header file that both then
include, and define them in replsbr.c.

8 years agouip: Replace some ints that are only ever 0 or 1 with bool.
Ralph Corderoy [Wed, 1 Nov 2017 17:21:23 +0000 (17:21 +0000)]
uip: Replace some ints that are only ever 0 or 1 with bool.

Knowing the domain of the variable is Boolean aids comprehension of the
variable's name and purpose.

8 years agosend.c, whatnowsbr.c: Delete option variables set but never read.
Ralph Corderoy [Wed, 1 Nov 2017 11:39:37 +0000 (11:39 +0000)]
send.c, whatnowsbr.c: Delete option variables set but never read.

Some options are passed on without the code parsing the options having
to act upon their value.  These don't need to store the option's Boolean
value in a local variable that's never read.

8 years agoMerge branch 'master' of git.sv.gnu.org:/srv/git/nmh
Ken Hornstein [Wed, 1 Nov 2017 00:48:40 +0000 (20:48 -0400)]
Merge branch 'master' of git.sv.gnu.org:/srv/git/nmh

8 years agoClean up things a bit
Ken Hornstein [Wed, 1 Nov 2017 00:48:31 +0000 (20:48 -0400)]
Clean up things a bit

8 years agouip: Replace some ints that are only ever 0 or 1 with bool.
Ralph Corderoy [Wed, 1 Nov 2017 00:09:32 +0000 (00:09 +0000)]
uip: Replace some ints that are only ever 0 or 1 with bool.

Knowing the domain of the variable is Boolean aids comprehension of the
variable's name and purpose.

8 years agomhbuild.c, mhbuildsbr.c: Replace three global ints with bools.
Ralph Corderoy [Tue, 31 Oct 2017 23:46:14 +0000 (23:46 +0000)]
mhbuild.c, mhbuildsbr.c: Replace three global ints with bools.

Knowing the domain of the variable is Boolean aids comprehension of the
variable's name and purpose.

8 years agoReplace some ints that are only ever 0 or 1 with bool.
Ralph Corderoy [Tue, 31 Oct 2017 23:33:34 +0000 (23:33 +0000)]
Replace some ints that are only ever 0 or 1 with bool.

Knowing the domain of the variable is Boolean aids comprehension of the
variable's name and purpose.

8 years agodtimep.l: Delete unused macros SKIPSP and SKIPTOSP.
Ralph Corderoy [Tue, 31 Oct 2017 21:37:24 +0000 (21:37 +0000)]
dtimep.l: Delete unused macros SKIPSP and SKIPTOSP.

Silences gcc's warnings.

8 years agoDisplay the command when reporting timing.
Ken Hornstein [Tue, 31 Oct 2017 18:44:04 +0000 (14:44 -0400)]
Display the command when reporting timing.

8 years agouip: Change global int userrs to bool.
Ralph Corderoy [Mon, 30 Oct 2017 23:32:58 +0000 (23:32 +0000)]
uip: Change global int userrs to bool.

8 years agouip: Replace some ints that are only ever 0 or 1 with bool.
Ralph Corderoy [Mon, 30 Oct 2017 23:29:32 +0000 (23:29 +0000)]
uip: Replace some ints that are only ever 0 or 1 with bool.

Knowing the domain of the variable is Boolean aids comprehension of the
variable's name and purpose.

8 years agosbr: Replace some ints that are only ever 0 or 1 with bool.
Ralph Corderoy [Mon, 30 Oct 2017 22:13:02 +0000 (22:13 +0000)]
sbr: Replace some ints that are only ever 0 or 1 with bool.

Knowing the domain of the variable is Boolean aids comprehension of the
variable's name and purpose.

8 years agomts/smtp/smtp.c: Replace int with bool.
Ralph Corderoy [Mon, 30 Oct 2017 22:11:15 +0000 (22:11 +0000)]
mts/smtp/smtp.c: Replace int with bool.

8 years agonmh_init(): Replace integer parameter with two bools.
Ralph Corderoy [Mon, 30 Oct 2017 20:58:46 +0000 (20:58 +0000)]
nmh_init(): Replace integer parameter with two bools.

Removes the 0, 1, or 2 passed by callers.  If the options get more
complex then an enum of possible actions might be a better fit.

8 years agoReplace adios(NULL, ...) with die(...).
Ralph Corderoy [Mon, 30 Oct 2017 20:29:29 +0000 (20:29 +0000)]
Replace adios(NULL, ...) with die(...).

It's the common case, and saves having to skip over the NULL when
reading, and avoids the risk of the format string being passed as the
first parameter by mistake.

8 years agoReplace printf(3) with fputs(3) where possible.
Ralph Corderoy [Mon, 30 Oct 2017 19:55:14 +0000 (19:55 +0000)]
Replace printf(3) with fputs(3) where possible.

The format string has no format specifiers, and doesn't end with `\n',
so fputs() to stdout is sufficient.

8 years agomhbuild.man: Avoid using format-free printf(3) in example.
Ralph Corderoy [Mon, 30 Oct 2017 19:52:11 +0000 (19:52 +0000)]
mhbuild.man: Avoid using format-free printf(3) in example.

It pops up in searches for printf()s that could be fputs(),
and as printf() it doesn't output the trailing `\n' to end the line.
Replace with puts().  Lowercase Kernighan's message, as he wrote it.

8 years agomsgchk.c: Rewrite checkmail(), removing need for macros.
Ralph Corderoy [Sat, 28 Oct 2017 22:04:54 +0000 (23:04 +0100)]
msgchk.c: Rewrite checkmail(), removing need for macros.

NONEOK, MMDFOLD, etc., were only used to track simple Boolean
conditions.  Rewriting the function removes the need for them, and gives
shorter, more clear, code.  The macros pre-date git's history.

8 years agoSPECS: Use `command-line interface' in one-line summary.
Ralph Corderoy [Sat, 28 Oct 2017 13:09:06 +0000 (14:09 +0100)]
SPECS: Use `command-line interface' in one-line summary.

Requested by David on nmh-workers.  `shell' is still mentioned in the
description for searches.

8 years agowhatnow: Remove undocumented printf-formatting of -prompt string.
Ralph Corderoy [Sat, 28 Oct 2017 12:57:00 +0000 (13:57 +0100)]
whatnow: Remove undocumented printf-formatting of -prompt string.

whatnow(1)'s -prompt option would use the value as a printf(3) format
string, supplying `invo_name' as the sole value to be formatted.  This
was undocumented, and upset gcc's checking of format strings.  As no
requests to keep the ability appeared on nmh-workers in reply to
2017-08-09's email, treat -prompt's value as a simple string.

8 years agoSPECS: Alter description to not require a GUI interface.
Ralph Corderoy [Sat, 28 Oct 2017 11:38:05 +0000 (12:38 +0100)]
SPECS: Alter description to not require a GUI interface.

xmh or exmh are optional, not required to use nmh.  Mention them both,
but remove the dependency on whether either is available as a package.
Add possible search terms, e.g. `MIME' and `shell'.

8 years agoconfigure.ac: Test for libtinfo to resolve setupterm(3).
Ralph Corderoy [Fri, 27 Oct 2017 11:28:28 +0000 (12:28 +0100)]
configure.ac: Test for libtinfo to resolve setupterm(3).

ncurses 6.0+20170902-2 on Arch Linux doesn't provide setupterm();  it
did in earlier versions.  This stops ./configure finding a suitable
library.  Add tinfo to the search list, as that's the lower-level
library that contains setupterm() now, and place it before curses and
ncurses so the search stops if it's sufficient instead of the larger
libraries.

8 years agomsgchk.c: Remove UUCP tests; unused since `#ifdef MF'.
Ralph Corderoy [Tue, 26 Sep 2017 20:14:06 +0000 (21:14 +0100)]
msgchk.c: Remove UUCP tests; unused since `#ifdef MF'.

The values UUCPOLD et al are never set so don't bother testing for them.
They haven't be possible in git's history.  They were guarded in the
past by `#ifdef MF';  that stood for `mail filter'.

8 years agoReplace getcpy(f()) calls with mh_xstrdup() when f() can't be NULL.
Ralph Corderoy [Tue, 26 Sep 2017 13:32:08 +0000 (14:32 +0100)]
Replace getcpy(f()) calls with mh_xstrdup() when f() can't be NULL.

And comment a few functions as never returning NULL along the way.

8 years agoDelete "blank" lines at start of files to bring content into view.
Ralph Corderoy [Mon, 25 Sep 2017 16:43:04 +0000 (17:43 +0100)]
Delete "blank" lines at start of files to bring content into view.

8 years agoutils.c: Improve comment describing add(). Suggest mh_xstrdup().
Ralph Corderoy [Mon, 25 Sep 2017 10:36:36 +0000 (11:36 +0100)]
utils.c: Improve comment describing add().  Suggest mh_xstrdup().

8 years agoimaptest.c: Don't use error message as adios()'s format.
Ralph Corderoy [Fri, 27 Oct 2017 15:36:57 +0000 (16:36 +0100)]
imaptest.c: Don't use error message as adios()'s format.

Add a `"%s"' format string.  Stops gcc complaining.

8 years agoimaptest.c: Don't test possibly uninitialised local variable.
Ralph Corderoy [Fri, 27 Oct 2017 12:44:26 +0000 (13:44 +0100)]
imaptest.c: Don't test possibly uninitialised local variable.

get_imap_response() doesn't necessarily set the content of a non-NULL
`char **status'.  Do this before calling, and check if it's been set to
non-NULL before using upon return.

8 years agoimaptest.c: Don't free brkstring()'s value; it's re-used.
Ralph Corderoy [Fri, 27 Oct 2017 12:00:13 +0000 (13:00 +0100)]
imaptest.c: Don't free brkstring()'s value; it's re-used.

Subsequent calls to brkstring() write to free'd memory, corrupting
malloc()'s internal data.

8 years agoimaptest.c: Add `format(printf, ...)' attribute to functions.
Ralph Corderoy [Fri, 27 Oct 2017 11:31:54 +0000 (12:31 +0100)]
imaptest.c: Add `format(printf, ...)' attribute to functions.

Stops warnings from gcc for send_imap_command() and add_msg().

8 years agoFix invalid pointer arithmetic.
Ken Hornstein [Fri, 27 Oct 2017 01:53:58 +0000 (21:53 -0400)]
Fix invalid pointer arithmetic.

Reported by David Levine.

8 years agoSupport command issuance and timestamps.
Ken Hornstein [Thu, 26 Oct 2017 17:47:12 +0000 (13:47 -0400)]
Support command issuance and timestamps.

8 years agoStill more fiddling.
Ken Hornstein [Thu, 26 Oct 2017 04:30:49 +0000 (00:30 -0400)]
Still more fiddling.

8 years agoAdd netsec_get_sasl_ssf().
Ken Hornstein [Thu, 26 Oct 2017 03:18:02 +0000 (23:18 -0400)]
Add netsec_get_sasl_ssf().

Add the function netsec_get_sasl_ssf(), which retrieves the SSF
(strength security factor) negotiated as part of the SASL exchange.

8 years agoA little closer to being somewhat useful.
Ken Hornstein [Wed, 25 Oct 2017 20:00:09 +0000 (16:00 -0400)]
A little closer to being somewhat useful.

8 years agoMake snoop work like it used to for SMTP.
Ken Hornstein [Wed, 25 Oct 2017 17:16:31 +0000 (13:16 -0400)]
Make snoop work like it used to for SMTP.

8 years agoFix up some const and unsigned char warnings.
Ken Hornstein [Wed, 25 Oct 2017 17:16:04 +0000 (13:16 -0400)]
Fix up some const and unsigned char warnings.

8 years agoImproved, a bit. Slightly more useful.
Ken Hornstein [Wed, 25 Oct 2017 04:01:56 +0000 (00:01 -0400)]
Improved, a bit.  Slightly more useful.

8 years agoRework snoop support slightly for the new world order.
Ken Hornstein [Wed, 25 Oct 2017 03:56:16 +0000 (23:56 -0400)]
Rework snoop support slightly for the new world order.

Make sure we do base64 snoop decoding at flush time.  Still need to
fix SMTP support.

8 years agoRototill snoop support so it works at flush time.
Ken Hornstein [Wed, 25 Oct 2017 03:16:31 +0000 (23:16 -0400)]
Rototill snoop support so it works at flush time.

Before on writes, the output snoop support would only work when it was
doing netsec_vprintf().  Do it at flush time, so it should work for
any type of write.

8 years agoIt does just what it says on the tin.
Ken Hornstein [Tue, 24 Oct 2017 19:32:54 +0000 (15:32 -0400)]
It does just what it says on the tin.

You should not use this unless you're the sort of person who regularly
reads the commit log. Still incomplete for now.

8 years agoAdd context information to SASL callback.
Ken Hornstein [Tue, 24 Oct 2017 18:47:19 +0000 (14:47 -0400)]
Add context information to SASL callback.

Provide an extra context argument for the SASL negotiation callback
that application code can use to pass down information that the
callback might need.

8 years agoSwitch to the use of to_upper() instead of custom code.
Ken Hornstein [Tue, 24 Oct 2017 18:44:53 +0000 (14:44 -0400)]
Switch to the use of to_upper() instead of custom code.

8 years agoImprove this documentation a bit.
Ken Hornstein [Sun, 22 Oct 2017 01:24:47 +0000 (21:24 -0400)]
Improve this documentation a bit.

8 years agoRemove mmdf_magic and empty_line temp files on success.
David Levine [Tue, 26 Sep 2017 15:36:22 +0000 (11:36 -0400)]
Remove mmdf_magic and empty_line temp files on success.

Fixes commit b46d49ba.

8 years agopicksbr.c: fprintf(3) function pointer using `%p' and union.
Ralph Corderoy [Sun, 24 Sep 2017 15:22:15 +0000 (16:22 +0100)]
picksbr.c: fprintf(3) function pointer using `%p' and union.

Using `%#llx' and cast to `unsigned long long' caused Cygwin woes.
Fixes 07916b2ff.

8 years agoslocal.c: Use C99's `%td' to printf(3) ptrdiff_t values.
Ralph Corderoy [Sun, 24 Sep 2017 15:06:16 +0000 (16:06 +0100)]
slocal.c: Use C99's `%td' to printf(3) ptrdiff_t values.

Using `%ld' caused Cygwin woes.  Fixes 6015bb1f7.

8 years agoinc/test-eom-align: Cut down on the flicker by re-ordering tests.
Ralph Corderoy [Sun, 24 Sep 2017 14:45:25 +0000 (15:45 +0100)]
inc/test-eom-align: Cut down on the flicker by re-ordering tests.

8 years agoinc/test-eom-align: Replace case on $MBOX_TYPE with interpolation.
Ralph Corderoy [Sun, 24 Sep 2017 14:41:58 +0000 (15:41 +0100)]
inc/test-eom-align: Replace case on $MBOX_TYPE with interpolation.

8 years agoinc/test-eom-align: rm(1) unwanted +inbox emails, not rmm(1).
Ralph Corderoy [Sun, 24 Sep 2017 14:04:05 +0000 (15:04 +0100)]
inc/test-eom-align: rm(1) unwanted +inbox emails, not rmm(1).

Using rmm(1) is using the software under test.  And about 50 times
slower.

8 years agoinc/test-eom-align: Create test mboxes in less steps.
Ralph Corderoy [Sun, 24 Sep 2017 13:26:02 +0000 (14:26 +0100)]
inc/test-eom-align: Create test mboxes in less steps.

Use a couple of temporary files created at the beginning to allow runs
of alternating cat(1) and echo(1) to be a single cat.  Knocks 15% off
the `make check' time for that single test in a simple trial here.

8 years agoinc/test-eom-align: Fix MMDF-mbox `B' size calculation.
Ralph Corderoy [Sun, 24 Sep 2017 13:10:18 +0000 (14:10 +0100)]
inc/test-eom-align: Fix MMDF-mbox `B' size calculation.

Also, have the email body end in what appears to be the MMDF magic
string for the first few bytes;  otherwise, the test mbox is just a
boring single email compared to the `A', From_, version.  Fixes
8699f1cc.

8 years agoinc/test-eom-align: Fix MMDF-mbox `A' size calculation.
Ralph Corderoy [Sun, 24 Sep 2017 12:49:32 +0000 (13:49 +0100)]
inc/test-eom-align: Fix MMDF-mbox `A' size calculation.

The `...LINESZ' variables are number of bytes, not number of lines, so
MMDF's is now 5 rather than 1.  And the MMDF magic string tops and tails
each email so needs to be subtracted twice, not once like From_'s.
Fixes 8699f1cc.

8 years agotest/common.sh.in: Only rm(1) if the cd(1) succeeds.
Ralph Corderoy [Sun, 24 Sep 2017 12:12:46 +0000 (13:12 +0100)]
test/common.sh.in: Only rm(1) if the cd(1) succeeds.

The rm specified the full path anyway, but if the cd fails for some odd
reason then it's best not to continue.

8 years agoannosbr.c: free(3) takes void pointer; don't cast non-const pointer.
Ralph Corderoy [Sun, 24 Sep 2017 11:56:26 +0000 (12:56 +0100)]
annosbr.c: free(3) takes void pointer; don't cast non-const pointer.

(const pointers are another whole can of worms, and their const
poisoning causes much noise for little benefit.)

8 years agovoid-pointer parameters don't need casting to char pointer.
Ralph Corderoy [Sun, 24 Sep 2017 11:31:35 +0000 (12:31 +0100)]
void-pointer parameters don't need casting to char pointer.

E.g. `memcmp((char *)digest...' doesn't need the cast if it's already a
pointer.

8 years agoReplace `sizeof (char)' with 1, then remove if a multiplier.
Ralph Corderoy [Sun, 24 Sep 2017 11:21:48 +0000 (12:21 +0100)]
Replace `sizeof (char)' with 1, then remove if a multiplier.

8 years agoDon't cast void pointer return value of malloc() et al.
Ralph Corderoy [Sun, 24 Sep 2017 11:20:26 +0000 (12:20 +0100)]
Don't cast void pointer return value of malloc() et al.

8 years agoStop failed m_mktemp2() that give directory reporting get_temp_dir().
Ralph Corderoy [Sat, 23 Sep 2017 21:27:46 +0000 (22:27 +0100)]
Stop failed m_mktemp2() that give directory reporting get_temp_dir().

The first parameter of m_mktemp2(), if not NULL, is a path and the
basename is used as the directory to hold the new temporary file, but
the error message on failing to create that used get_temp_dir() and
that's often somewhere else, e.g. `mhbuild /dev/null' attempts /dev/...
Don't attempt to state the failed path in the error message as at least
that's not misleading.  Perhaps the function needs some other indication
of success so it can pass back the attempted filename that failed.

8 years agomhbuild.c: Don't use set_done() to unlink temporary files.
Ralph Corderoy [Sat, 23 Sep 2017 17:16:26 +0000 (18:16 +0100)]
mhbuild.c: Don't use set_done() to unlink temporary files.

Because they're created with m_mktemp2(), the temporary files are
already in a list to be unlink(2)'d at exit(3), thanks to atexit(3), so
don't set_done() to attempt that twice.  Updates 6bc64765f.

8 years agomhshow/test-charset: Test iconv(1)'s result, not just its exit status.
Ralph Corderoy [Sat, 23 Sep 2017 13:29:38 +0000 (14:29 +0100)]
mhshow/test-charset: Test iconv(1)'s result, not just its exit status.

Problems with generating the input to iconv(1) were hidden as long as it
could be converted from EBCDIC-US to UTF-8 because only the exit status
was tested.  Check the output is as expected too.

8 years agomhshow/test-charset: printf(1)'s octal doesn't need a leading zero.
Ralph Corderoy [Sat, 23 Sep 2017 13:14:12 +0000 (14:14 +0100)]
mhshow/test-charset: printf(1)'s octal doesn't need a leading zero.

The `\0344' was being interpreted as `\034' and `4'.  This can still be
converted from EBCDIC-US to UTF-8 by iconv(1) so the test worked, but it
was misleading.  Remove the leading zero as printf's octal escape is
`\nnn' where nnn is one to three octal digits.  It's echo(1) that
insists on a leading zero.  Fixes 6fd1d18f.

8 years agoinc/test-eom-align: Use octal, not hex, in printf(1) format string.
Ralph Corderoy [Sat, 23 Sep 2017 10:43:12 +0000 (11:43 +0100)]
inc/test-eom-align: Use octal, not hex, in printf(1) format string.

POSIX's printf(1), and dash(1)'s, does not support hex.  Fixes 8699f1cc.

8 years agomhshow/test-charset: Use octal, not hex, in printf(1) format string.
Ralph Corderoy [Sat, 23 Sep 2017 10:40:39 +0000 (11:40 +0100)]
mhshow/test-charset: Use octal, not hex, in printf(1) format string.

POSIX's printf(1), and dash(1)'s, does not support hex.  Fixes 792d7e1e.

8 years agoAdded tests of MMDF mailbox format to test-eom-align.
David Levine [Fri, 22 Sep 2017 23:05:49 +0000 (19:05 -0400)]
Added tests of MMDF mailbox format to test-eom-align.

8 years agorunpty.c: Move child slave code into new run_command().
Ralph Corderoy [Fri, 22 Sep 2017 12:04:12 +0000 (13:04 +0100)]
runpty.c: Move child slave code into new run_command().

8 years agorunpty.c: Handle fork(2) failure first, rather than child.
Ralph Corderoy [Fri, 22 Sep 2017 11:49:47 +0000 (12:49 +0100)]
runpty.c: Handle fork(2) failure first, rather than child.

Gets the error handling out of the way so it can be forgotten.

8 years agorunpty.c: Factor duplicate code into new open_master_pty().
Ralph Corderoy [Fri, 22 Sep 2017 11:47:02 +0000 (12:47 +0100)]
runpty.c: Factor duplicate code into new open_master_pty().

Only called twice, but it shows the same actions are done both times.

8 years agorunpty.c: Replace fprintf()+exit() pairs with new die().
Ralph Corderoy [Fri, 22 Sep 2017 11:36:05 +0000 (12:36 +0100)]
runpty.c: Replace fprintf()+exit() pairs with new die().

8 years agoDetect function-pointer `done' being set twice in a row.
Ralph Corderoy [Thu, 21 Sep 2017 15:59:15 +0000 (16:59 +0100)]
Detect function-pointer `done' being set twice in a row.

Make `done' a function that uses a file-static function pointer, and add
set_done() to alter it.  That wants either the old or new value to be
exit(3).  If it's not, it still alters the stored pointer, to maintain
the existing behaviour, but emits a warning on stderr.  mhbuild(1)
triggers that warning, making this hunch worthwhile.

8 years agoman: Replace csh `%' prompt in examples with sh's `$'.
Ralph Corderoy [Thu, 21 Sep 2017 13:21:38 +0000 (14:21 +0100)]
man: Replace csh `%' prompt in examples with sh's `$'.

Youngsters these days probably wouldn't recognise csh.  None of the
commands needed changing due to syntax differences.

8 years agomh-draft.man: Use ASCII double-quote for itself in example output.
Ralph Corderoy [Thu, 21 Sep 2017 13:12:00 +0000 (14:12 +0100)]
mh-draft.man: Use ASCII double-quote for itself in example output.

Not the TeX doubling of backquote and single-quote.

8 years agoman: Add backslash before backquote so it appears as sh backtick.
Ralph Corderoy [Thu, 21 Sep 2017 13:05:05 +0000 (14:05 +0100)]
man: Add backslash before backquote so it appears as sh backtick.

8 years agoman: Fix backquote used in error for single quote.
Ralph Corderoy [Tue, 19 Sep 2017 22:16:36 +0000 (23:16 +0100)]
man: Fix backquote used in error for single quote.

A repeated bit of prose had the typo `foo` instead of `foo'.

8 years agomhlsbr.c: Delete file-static function pointer mhl_action.
Ralph Corderoy [Tue, 19 Sep 2017 10:43:30 +0000 (11:43 +0100)]
mhlsbr.c: Delete file-static function pointer mhl_action.

Never set, so always NULL due to BSS.  It used to be set by c808c5d5.

8 years agomhlsbr.c: Delete `jmp_buf mhlenv', never setjmp(3)'d.
Ralph Corderoy [Tue, 19 Sep 2017 10:38:52 +0000 (11:38 +0100)]
mhlsbr.c: Delete `jmp_buf mhlenv', never setjmp(3)'d.

Only ever conditionally longjmp(3)'d.  The setjmp() was removed by
c808c5d5.

8 years agoStrip parenthesis from `return (state = OK);' and similar.
Ralph Corderoy [Mon, 18 Sep 2017 23:00:08 +0000 (00:00 +0100)]
Strip parenthesis from `return (state = OK);' and similar.

There are sufficient cases without the parenthesis that various
compilers must be happy without.

8 years agopop_init(): After proxy's execve(2) failure, exit(1), not exit(10).
Ralph Corderoy [Mon, 18 Sep 2017 22:38:27 +0000 (23:38 +0100)]
pop_init(): After proxy's execve(2) failure, exit(1), not exit(10).

The value 10 seems undocumented, and I can't find anything that tests
for that specific value.

8 years agosendfiles: Always die with exit status of 1 rather than -1.
Ralph Corderoy [Mon, 18 Sep 2017 22:29:24 +0000 (23:29 +0100)]
sendfiles: Always die with exit status of 1 rather than -1.

The sh function die() took the exit status as an optional parameter,
with a default of -1, but this was never used so remove the option and
always use an exit status of 1.

8 years agoRemove preprocessor conditionals on `lint'.
Ralph Corderoy [Mon, 18 Sep 2017 14:28:26 +0000 (15:28 +0100)]
Remove preprocessor conditionals on `lint'.

Treat all tests for `lint' being defined as false.  Don't know when
anyone had a lint(1) that could be run on the source, but none of the
areas had been touched in git's history, and at least one would have
been a compile error had it been defined.

8 years agoReplace `_exit(-1)' with `_exit(1)'.
Ralph Corderoy [Mon, 18 Sep 2017 14:04:07 +0000 (15:04 +0100)]
Replace `_exit(-1)' with `_exit(1)'.

In line with other changes to limit a process's exit value to small
non-negative integers distinguishable with sh's `$?'.

8 years agowhom.c: Don't call rename(2) with source that's uninitialised.
Ralph Corderoy [Mon, 18 Sep 2017 11:43:28 +0000 (12:43 +0100)]
whom.c: Don't call rename(2) with source that's uninitialised.

The intent is that two rename(2)s take place: to move a file to a
backup and then return it.  The first test controlled the generation of
the destination in the char array `backup' and calling the first
rename().  The second test used that same array for the restoring
rename(), but used a different test and so could run when the first
rename hadn't, and with an uninitialised array for the source filename.

The initialisation of `backup' and the first rename needed both
environment variables `mhdist' and `mhaltmsg' to be non-empty, and the
former to have a non-zero atoi(3) value.  The second rename ignored
`mhaltmsg'.  Bug pre-dates git.