indent(1): Untangle the connection between pr_comment.c and io.c.
commitb88b0240d8bb2387537e00cd6c0e0cc05f4959e8
authorpfg <pfg@FreeBSD.org>
Sun, 31 Jul 2016 21:09:22 +0000 (31 21:09 +0000)
committerpfg <pfg@FreeBSD.org>
Sun, 31 Jul 2016 21:09:22 +0000 (31 21:09 +0000)
treec76a07afcf19a8efb7b76c2afe4bc5ee695ffe9e
parentd25e87a4edacc47e81e39bef66e592938ffc77dc
indent(1): Untangle the connection between pr_comment.c and io.c.

It's pr_comment.c that should decide whether to put a "star comment
continuation" or not. This duplicates code a bit, but it simplifies
pr_comment() at the same time since pr_comment() no longer has to "signal"
whether a star continuation is needed or not.

This change requires indent(1) to not wrap comment lines that lack a blank
character, but I think it's for the better if you look at cases when that
happens (mostly long URIs and file system paths, which arguably shouldn't
be wrapped).

It also fixes two bugs:

1. Cases where asterisk is a part of the comment's content (like in "*we*
are the champions") and happens to appear at the beginning of the line,
misleading dump_line() into thinking that this is part of the star comment
continuation, leading to misalignment.

2. Cases where blank starred lines had three too many characters on the
line when wrapped.

Reference:
https://github.com/pstef/freebsd_indent/commit/3b41ee78aafafc7c3e662b794835e3253218dbb3

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by: Piotr Stefaniak
usr.bin/indent/io.c
usr.bin/indent/pr_comment.c