]> git.draconx.ca Git - dxcommon.git/commit
help_print_desc: Simplify implementation.
authorNick Bowler <nbowler@draconx.ca>
Tue, 5 Dec 2023 01:55:43 +0000 (20:55 -0500)
committerNick Bowler <nbowler@draconx.ca>
Tue, 5 Dec 2023 01:57:06 +0000 (20:57 -0500)
commitf7845ef1698291a23975052a100c12bf38a0664d
treebc9ed98668bc9fe44397ea87ba104f51884379bb
parentc3f53b697f5dd5ecd5a5f74e94ec0fd55b0f2764
help_print_desc: Simplify implementation.

Simplify the way this function works by basing the loop around strcspn.

There is a slight change of behaviour when called with i==0 and an empty
description.   Previously, no newline was printed.  Now, a newline is
printed.  I think the original behaviour was a mistake as it does not
make much sense (and this function serves no real purpose unless i is
nonzero).  The tests are updated to expect this behaviour change.

As a bonus, we no longer tickle a problem with some ancient systems
(e.g., ULTRIX 4.5) which have a printf that doesn't support a negative
precision argument to mean "default precision".  This problem actually
has no coverage in the test suite, so fix that up too.
src/help.c
src/help.h
tests/functions.at