From 67b7daecf7fa6762400aa173323c9b442703420f Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Thu, 1 Dec 2016 01:48:56 +0000 Subject: [PATCH] indent(1): Don't ignore newlines after comments that follow braces. indent.c has a special loop that stores tokens from between an if () and the next statement into a buffer. The loop ignored all newlines, but that resulted in not calling dump_line() when it was needed to produce the final line of the buffered up comment. Taken from: Piotr Stefaniak --- usr.bin/indent/indent.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index 668702bb5d6c..5bcef2793220 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -335,8 +335,10 @@ main(int argc, char **argv) switch (type_code) { case newline: ++line_no; - if (sc_end != NULL) - goto sw_buffer; /* dump comment, if any */ + if (sc_end != NULL) { /* dump comment, if any */ + *sc_end++ = '\n'; /* newlines are needed in this case */ + goto sw_buffer; + } flushed_nl = true; case form_feed: break; /* form feeds and newlines found here will be