Module Name:    src
Committed By:   rillig
Date:           Sun Sep 26 19:37:11 UTC 2021

Modified Files:
        src/usr.bin/indent: args.c indent.c io.c lexi.c parse.c pr_comment.c

Log Message:
indent: let indent format its own code -- in supervised mode

After running indent on the code, I manually selected each change that
now looks better than before. The remaining changes are left for later.
All in all, indent did a pretty good job, except for syntactic additions
from after 1990, but that was to be expected. Examples for such
additions are GCC's __attribute__ and C99 designated initializers.

Indent has only few knobs to tune the indentation. The knob for the
continuation indentation applies to function declarations as well as to
expressions. The knob for indentation of local variable declarations
applies to struct members as well, even if these are members of a
top-level struct.

Several code comments crossed the right margin in column 78. Several
other code comments were correctly broken though. The cause for this
difference was not obvious.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/indent/args.c
cvs rdiff -u -r1.85 -r1.86 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/indent/io.c
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.26 -r1.27 src/usr.bin/indent/parse.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/indent/pr_comment.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/args.c
diff -u src/usr.bin/indent/args.c:1.32 src/usr.bin/indent/args.c:1.33
--- src/usr.bin/indent/args.c:1.32	Sun Sep 26 00:57:28 2021
+++ src/usr.bin/indent/args.c	Sun Sep 26 19:37:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.32 2021/09/26 00:57:28 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.33 2021/09/26 19:37:11 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.32 2021/09/26 00:57:28 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.33 2021/09/26 19:37:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -87,11 +87,11 @@ static const char *option_source = "?";
  * See also set_special_option.
  */
 static const struct pro {
-    const char  p_name[6];	/* name, e.g. "bl", "cli" */
-    bool	p_is_bool;
-    bool	p_bool_value;
-    void        *p_obj;		/* the associated variable (bool, int) */
-}           pro[] = {
+    const char p_name[6];	/* name, e.g. "bl", "cli" */
+    bool p_is_bool;
+    bool p_bool_value;
+    void *p_obj;		/* the associated variable (bool, int) */
+}   pro[] = {
     bool_option("bacc", true, opt.blanklines_around_conditional_compilation),
     bool_option("badp", true, opt.blanklines_after_declarations_at_proctop),
     bool_option("bad", true, opt.blanklines_after_declarations),
@@ -174,11 +174,11 @@ set_profile(const char *profile_name)
 	snprintf(fname, sizeof(fname), "%s", profile_name + 2);
     if ((f = fopen(option_source = fname, "r")) != NULL) {
 	scan_profile(f);
-	(void) fclose(f);
+	(void)fclose(f);
     }
     if ((f = fopen(option_source = prof, "r")) != NULL) {
 	scan_profile(f);
-	(void) fclose(f);
+	(void)fclose(f);
     }
     option_source = "Command line";
 }
@@ -186,9 +186,9 @@ set_profile(const char *profile_name)
 static void
 scan_profile(FILE *f)
 {
-    int		comment_index, i;
-    char	*p;
-    char        buf[BUFSIZ];
+    int comment_index, i;
+    char *p;
+    char buf[BUFSIZ];
 
     for (;;) {
 	p = buf;
@@ -235,7 +235,7 @@ set_special_option(const char *arg)
     if (strncmp(arg, "-version", 8) == 0) {
 	printf("FreeBSD indent %s\n", INDENT_VERSION);
 	exit(0);
-	/*NOTREACHED*/
+	/* NOTREACHED */
     }
 
     if (arg[0] == 'P' || strncmp(arg, "npro", 4) == 0)
@@ -285,7 +285,7 @@ void
 set_option(const char *arg)
 {
     const struct pro *p;
-    const char	*param_start;
+    const char *param_start;
 
     arg++;			/* ignore leading "-" */
     if (set_special_option(arg))

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.85 src/usr.bin/indent/indent.c:1.86
--- src/usr.bin/indent/indent.c:1.85	Sun Sep 26 18:52:16 2021
+++ src/usr.bin/indent/indent.c	Sun Sep 26 19:37:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.85 2021/09/26 18:52:16 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.86 2021/09/26 19:37:11 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.85 2021/09/26 18:52:16 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.86 2021/09/26 19:37:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -65,25 +65,25 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #include "indent.h"
 
 struct options opt = {
-	.leave_comma = true,
-	.btype_2 = true,
-	.comment_delimiter_on_blankline = true,
-	.cuddle_else = true,
-	.comment_column = 33,
-	.decl_indent = 16,
-	.else_if = true,
-	.function_brace_split = true,
-	.format_col1_comments = true,
-	.format_block_comments = true,
-	.indent_parameters = true,
-	.indent_size = 8,
-	.local_decl_indent = -1,
-	.lineup_to_parens = true,
-	.procnames_start_line = true,
-	.star_comment_cont = true,
-	.tabsize = 8,
-	.max_line_length = 78,
-	.use_tabs = true,
+    .leave_comma = true,
+    .btype_2 = true,
+    .comment_delimiter_on_blankline = true,
+    .cuddle_else = true,
+    .comment_column = 33,
+    .decl_indent = 16,
+    .else_if = true,
+    .function_brace_split = true,
+    .format_col1_comments = true,
+    .format_block_comments = true,
+    .indent_parameters = true,
+    .indent_size = 8,
+    .local_decl_indent = -1,
+    .lineup_to_parens = true,
+    .procnames_start_line = true,
+    .star_comment_cont = true,
+    .tabsize = 8,
+    .max_line_length = 78,
+    .use_tabs = true,
 };
 
 struct parser_state ps;
@@ -93,35 +93,35 @@ struct buffer code;
 struct buffer com;
 struct buffer token;
 
-char       *in_buffer;
-char	   *in_buffer_limit;
-char       *buf_ptr;
-char       *buf_end;
-
-char        sc_buf[sc_size];
-char       *save_com;
-char       *sc_end;
-
-char       *bp_save;
-char       *be_save;
-
-bool        found_err;
-int         n_real_blanklines;
-bool        prefix_blankline_requested;
-bool        postfix_blankline_requested;
-bool        break_comma;
-float       case_ind;
-bool        had_eof;
-int         line_no;
-bool        inhibit_formatting;
-int         suppress_blanklines;
+char *in_buffer;
+char *in_buffer_limit;
+char *buf_ptr;
+char *buf_end;
+
+char sc_buf[sc_size];
+char *save_com;
+char *sc_end;
+
+char *bp_save;
+char *be_save;
+
+bool found_err;
+int n_real_blanklines;
+bool prefix_blankline_requested;
+bool postfix_blankline_requested;
+bool break_comma;
+float case_ind;
+bool had_eof;
+int line_no;
+bool inhibit_formatting;
+int suppress_blanklines;
 
-int         ifdef_level;
+int ifdef_level;
 struct parser_state state_stack[5];
 struct parser_state match_state[5];
 
-FILE       *input;
-FILE       *output;
+FILE *input;
+FILE *output;
 
 static void bakcopy(void);
 static void indent_declaration(int, bool);
@@ -132,7 +132,7 @@ const char *out_name = "Standard Output"
 						 * of output file */
 const char *simple_backup_suffix = ".BAK";	/* Suffix to use for backup
 						 * files */
-char        bakfile[MAXPATHLEN] = "";
+char bakfile[MAXPATHLEN] = "";
 
 static void
 check_size_code(size_t desired_size)
@@ -168,7 +168,7 @@ init_capsicum(void)
 
 static void
 search_brace(token_type *inout_ttype, bool *inout_force_nl,
-	     bool *inout_comment_buffered, bool *inout_last_else)
+    bool *inout_comment_buffered, bool *inout_last_else)
 {
     while (ps.search_brace) {
 	switch (*inout_ttype) {
@@ -181,12 +181,12 @@ search_brace(token_type *inout_ttype, bo
 	    *sc_end++ = '\n';
 	    /*
 	     * We may have inherited a force_nl == true from the previous
-	     * token (like a semicolon). But once we know that a newline
-	     * has been scanned in this loop, force_nl should be false.
+	     * token (like a semicolon). But once we know that a newline has
+	     * been scanned in this loop, force_nl should be false.
 	     *
-	     * However, the force_nl == true must be preserved if newline
-	     * is never scanned in this loop, so this assignment cannot be
-	     * done earlier.
+	     * However, the force_nl == true must be preserved if newline is
+	     * never scanned in this loop, so this assignment cannot be done
+	     * earlier.
 	     */
 	    *inout_force_nl = false;
 	    break;
@@ -226,17 +226,17 @@ search_brace(token_type *inout_ttype, bo
 	    break;
 	case lbrace:
 	    /*
-	     * Put KNF-style lbraces before the buffered up tokens and
-	     * jump out of this loop in order to avoid copying the token
-	     * again under the default case of the switch below.
+	     * Put KNF-style lbraces before the buffered up tokens and jump
+	     * out of this loop in order to avoid copying the token again
+	     * under the default case of the switch below.
 	     */
 	    if (sc_end != NULL && opt.btype_2) {
 		save_com[0] = '{';
 		/*
-		 * Originally the lbrace may have been alone on its own
-		 * line, but it will be moved into "the else's line", so
-		 * if there was a newline resulting from the "{" before,
-		 * it must be scanned now and ignored.
+		 * Originally the lbrace may have been alone on its own line,
+		 * but it will be moved into "the else's line", so if there
+		 * was a newline resulting from the "{" before, it must be
+		 * scanned now and ignored.
 		 */
 		while (isspace((unsigned char)*buf_ptr)) {
 		    if (++buf_ptr >= buf_end)
@@ -303,28 +303,27 @@ search_brace(token_type *inout_ttype, bo
 	}
 	}			/* end of switch */
 	/*
-	 * We must make this check, just in case there was an unexpected
-	 * EOF.
+	 * We must make this check, just in case there was an unexpected EOF.
 	 */
 	if (*inout_ttype != end_of_file) {
 	    /*
 	     * The only intended purpose of calling lexi() below is to
 	     * categorize the next token in order to decide whether to
-	     * continue buffering forthcoming tokens. Once the buffering
-	     * is over, lexi() will be called again elsewhere on all of
-	     * the tokens - this time for normal processing.
+	     * continue buffering forthcoming tokens. Once the buffering is
+	     * over, lexi() will be called again elsewhere on all of the
+	     * tokens - this time for normal processing.
 	     *
 	     * Calling it for this purpose is a bug, because lexi() also
-	     * changes the parser state and discards leading whitespace,
-	     * which is needed mostly for comment-related considerations.
+	     * changes the parser state and discards leading whitespace, which
+	     * is needed mostly for comment-related considerations.
 	     *
-	     * Work around the former problem by giving lexi() a copy of
-	     * the current parser state and discard it if the call turned
-	     * out to be just a look ahead.
+	     * Work around the former problem by giving lexi() a copy of the
+	     * current parser state and discard it if the call turned out to
+	     * be just a look ahead.
 	     *
 	     * Work around the latter problem by copying all whitespace
-	     * characters into the buffer so that the later lexi() call
-	     * will read them.
+	     * characters into the buffer so that the later lexi() call will
+	     * read them.
 	     */
 	    if (sc_end != NULL) {
 		while (*buf_ptr == ' ' || *buf_ptr == '\t') {
@@ -355,7 +354,7 @@ static void
 buf_init(struct buffer *buf)
 {
     buf->buf = xmalloc(bufsize);
-    buf->buf[0] = ' ';			/* allow accessing buf->e[-1] */
+    buf->buf[0] = ' ';		/* allow accessing buf->e[-1] */
     buf->buf[1] = '\0';
     buf->s = buf->buf + 1;
     buf->e = buf->s;
@@ -504,9 +503,9 @@ process_end_of_file(void)
 
     if (opt.verbose) {
 	printf("There were %d output lines and %d comments\n",
-	       ps.stats.lines, ps.stats.comments);
+	    ps.stats.lines, ps.stats.comments);
 	printf("(Lines with comments)/(Lines with code): %6.3f\n",
-	       (1.0 * ps.stats.comment_lines) / ps.stats.code_lines);
+	    (1.0 * ps.stats.comment_lines) / ps.stats.code_lines);
     }
 
     fflush(output);
@@ -531,8 +530,8 @@ process_comment_in_code(token_type ttype
     ps.in_stmt = true;		/* turn on flag which causes an extra level of
 				 * indentation. this is turned off by a ';' or
 				 * '}' */
-    if (com.s != com.e) {	/* the turkey has embedded a comment
-				 * in a line. fix it */
+    if (com.s != com.e) {	/* the turkey has embedded a comment in a
+				 * line. fix it */
 	size_t len = com.e - com.s;
 
 	check_size_code(len + 3);
@@ -602,9 +601,8 @@ process_lparen_or_lbracket(int dec_ind, 
     }
     if (ps.in_or_st && *token.s == '(' && ps.tos <= 2) {
 	/*
-	 * this is a kluge to make sure that declarations will be
-	 * aligned right if proc decl has an explicit type on it, i.e.
-	 * "int a(x) {..."
+	 * this is a kluge to make sure that declarations will be aligned
+	 * right if proc decl has an explicit type on it, i.e. "int a(x) {..."
 	 */
 	parse(semicolon);	/* I said this was a kluge... */
 	ps.in_or_st = false;	/* turn off flag for structure decl or
@@ -617,7 +615,7 @@ process_lparen_or_lbracket(int dec_ind, 
 
 static void
 process_rparen_or_rbracket(bool *inout_sp_sw, bool *inout_force_nl,
-			   token_type hd_type)
+    token_type hd_type)
 {
     if ((ps.cast_mask & (1 << ps.p_l_follow) & ~ps.not_cast_mask) != 0) {
 	ps.last_u_d = true;
@@ -637,19 +635,20 @@ process_rparen_or_rbracket(bool *inout_s
 
     *code.e++ = token.s[0];
 
-    if (*inout_sp_sw && (ps.p_l_follow == 0)) {	/* check for end of if
-				 * (...), or some such */
+    if (*inout_sp_sw && (ps.p_l_follow == 0)) {	/* check for end of if (...),
+						 * or some such */
 	*inout_sp_sw = false;
 	*inout_force_nl = true;	/* must force newline after if */
-	ps.last_u_d = true;	/* inform lexi that a following
-				 * operator is unary */
+	ps.last_u_d = true;	/* inform lexi that a following operator is
+				 * unary */
 	ps.in_stmt = false;	/* dont use stmt continuation indentation */
 
 	parse(hd_type);		/* let parser worry about if, or whatever */
     }
-    ps.search_brace = opt.btype_2; /* this should ensure that constructs such
-				 * as main(){...} and int[]{...} have their
-				 * braces put in the right place */
+    ps.search_brace = opt.btype_2;	/* this should ensure that constructs
+					 * such as main(){...} and int[]{...}
+					 * have their braces put in the right
+					 * place */
 }
 
 static void
@@ -749,14 +748,14 @@ process_colon(int *inout_squest, bool *i
 
 static void
 process_semicolon(bool *inout_scase, int *inout_squest, int dec_ind,
-		  bool tabs_to_var, bool *inout_sp_sw,
-		  token_type hd_type,
-		  bool *inout_force_nl)
+    bool tabs_to_var, bool *inout_sp_sw,
+    token_type hd_type,
+    bool *inout_force_nl)
 {
     if (ps.decl_nest == 0)
 	ps.in_or_st = false;	/* we are not in an initialization or
 				 * structure declaration */
-    *inout_scase = false; /* these will only need resetting in an error */
+    *inout_scase = false;	/* these will only need resetting in an error */
     *inout_squest = 0;
     if (ps.last_token == rparen)
 	ps.in_parameter_declaration = false;
@@ -774,15 +773,15 @@ process_semicolon(bool *inout_scase, int
     }
 
     ps.in_decl = (ps.decl_nest > 0);	/* if we were in a first level
-						 * structure declaration, we
-						 * arent any more */
+					 * structure declaration, we arent any
+					 * more */
 
     if ((!*inout_sp_sw || hd_type != for_exprs) && ps.p_l_follow > 0) {
 
 	/*
-	 * This should be true iff there were unbalanced parens in the
-	 * stmt.  It is a bit complicated, because the semicolon might
-	 * be in a for stmt
+	 * This should be true iff there were unbalanced parens in the stmt.
+	 * It is a bit complicated, because the semicolon might be in a for
+	 * stmt
 	 */
 	diag(1, "Unbalanced parens");
 	ps.p_l_follow = 0;
@@ -794,20 +793,20 @@ process_semicolon(bool *inout_scase, int
     }
     *code.e++ = ';';
     ps.want_blank = true;
-    ps.in_stmt = (ps.p_l_follow > 0);	/* we are no longer in the
-				 * middle of a stmt */
+    ps.in_stmt = (ps.p_l_follow > 0);	/* we are no longer in the middle of a
+					 * stmt */
 
     if (!*inout_sp_sw) {	/* if not if for (;;) */
 	parse(semicolon);	/* let parser know about end of stmt */
-	*inout_force_nl = true;/* force newline after an end of stmt */
+	*inout_force_nl = true;	/* force newline after an end of stmt */
     }
 }
 
 static void
 process_lbrace(bool *inout_force_nl, bool *inout_sp_sw, token_type hd_type,
-	       int *di_stack, int di_stack_cap, int *inout_dec_ind)
+    int *di_stack, int di_stack_cap, int *inout_dec_ind)
 {
-    ps.in_stmt = false;	/* dont indent the {} */
+    ps.in_stmt = false;		/* dont indent the {} */
     if (!ps.block_init)
 	*inout_force_nl = true;	/* force other stuff on same line as '{' onto
 				 * new line */
@@ -822,8 +821,8 @@ process_lbrace(bool *inout_force_nl, boo
 	    ps.want_blank = false;
 	} else if (ps.in_parameter_declaration && !ps.in_or_st) {
 	    ps.ind_level_follow = 0;
-	    if (opt.function_brace_split) { /* dump the line prior
-				 * to the brace ... */
+	    if (opt.function_brace_split) {	/* dump the line prior to the
+						 * brace ... */
 		dump_line();
 		ps.want_blank = false;
 	    } else		/* add a space between the decl and brace */
@@ -833,8 +832,7 @@ process_lbrace(bool *inout_force_nl, boo
     if (ps.in_parameter_declaration)
 	prefix_blankline_requested = false;
 
-    if (ps.p_l_follow > 0) {	/* check for preceding unbalanced
-				 * parens */
+    if (ps.p_l_follow > 0) {	/* check for preceding unbalanced parens */
 	diag(1, "Unbalanced parens");
 	ps.p_l_follow = 0;
 	if (*inout_sp_sw) {	/* check for unclosed if, for, etc. */
@@ -847,19 +845,18 @@ process_lbrace(bool *inout_force_nl, boo
 	ps.ind_stmt = false;	/* dont put extra indentation on line
 				 * with '{' */
     if (ps.in_decl && ps.in_or_st) {	/* this is either a structure
-				 * declaration or an init */
+					 * declaration or an init */
 	di_stack[ps.decl_nest] = *inout_dec_ind;
 	if (++ps.decl_nest == di_stack_cap) {
 	    diag(0, "Reached internal limit of %d struct levels",
-		 di_stack_cap);
+		di_stack_cap);
 	    ps.decl_nest--;
 	}
 	/* ?		dec_ind = 0; */
     } else {
-	ps.decl_on_line = false;	/* we can't be in the middle of
-						 * a declaration, so don't do
-						 * special indentation of
-						 * comments */
+	ps.decl_on_line = false;	/* we can't be in the middle of a
+					 * declaration, so don't do special
+					 * indentation of comments */
 	if (opt.blanklines_after_declarations_at_proctop
 	    && ps.in_parameter_declaration)
 	    postfix_blankline_requested = true;
@@ -867,8 +864,8 @@ process_lbrace(bool *inout_force_nl, boo
 	ps.in_decl = false;
     }
     *inout_dec_ind = 0;
-    parse(lbrace);	/* let parser know about this */
-    if (ps.want_blank)	/* put a blank before '{' if '{' is not at
+    parse(lbrace);		/* let parser know about this */
+    if (ps.want_blank)		/* put a blank before '{' if '{' is not at
 				 * start of line */
 	*code.e++ = ' ';
     ps.want_blank = false;
@@ -880,7 +877,8 @@ static void
 process_rbrace(bool *inout_sp_sw, int *inout_dec_ind, const int *di_stack)
 {
     if (ps.p_stack[ps.tos] == decl && !ps.block_init)	/* semicolons can be
-				 * omitted in declarations */
+							 * omitted in
+							 * declarations */
 	parse(semicolon);
     if (ps.p_l_follow != 0) {	/* check for unclosed if, for, else. */
 	diag(1, "Unbalanced parens");
@@ -906,8 +904,8 @@ process_rbrace(bool *inout_sp_sw, int *i
     prefix_blankline_requested = false;
     parse(rbrace);		/* let parser know about this */
     ps.search_brace = opt.cuddle_else
-		      && ps.p_stack[ps.tos] == if_expr_stmt
-		      && ps.il[ps.tos] >= ps.ind_level;
+	&& ps.p_stack[ps.tos] == if_expr_stmt
+	&& ps.il[ps.tos] >= ps.ind_level;
     if (ps.tos <= 1 && opt.blanklines_after_procs && ps.decl_nest <= 0)
 	postfix_blankline_requested = true;
 }
@@ -971,7 +969,7 @@ process_decl(int *out_dec_ind, bool *out
 
 static void
 process_ident(token_type ttype, int dec_ind, bool tabs_to_var,
-	      bool *inout_sp_sw, bool *inout_force_nl, token_type hd_type)
+    bool *inout_sp_sw, bool *inout_force_nl, token_type hd_type)
 {
     if (ps.in_decl) {
 	if (ttype == funcname) {
@@ -984,8 +982,8 @@ process_ident(token_type ttype, int dec_
 	    }
 	    ps.want_blank = false;
 	} else if (!ps.block_init && !ps.dumped_decl_indent &&
-		   ps.paren_level == 0) { /* if we are in a declaration, we
-					    * must indent identifier */
+	    ps.paren_level == 0) {	/* if we are in a declaration, we must
+					 * indent identifier */
 	    indent_declaration(dec_ind, tabs_to_var);
 	    ps.dumped_decl_indent = true;
 	    ps.want_blank = false;
@@ -1037,8 +1035,8 @@ process_period(void)
 static void
 process_comma(int dec_ind, bool tabs_to_var, bool *inout_force_nl)
 {
-    ps.want_blank = (code.s != code.e);	/* only put blank after comma
-				 * if comma does not start the line */
+    ps.want_blank = (code.s != code.e);	/* only put blank after comma if comma
+					 * does not start the line */
     if (ps.in_decl && ps.procname[0] == '\0' && !ps.block_init &&
 	!ps.dumped_decl_indent && ps.paren_level == 0) {
 	/* indent leading commas and not the actual identifiers */
@@ -1063,13 +1061,13 @@ process_preprocessing(void)
     if (com.s != com.e || lab.s != lab.e || code.s != code.e)
 	dump_line();
     check_size_label(1);
-    *lab.e++ = '#';	/* move whole line to 'label' buffer */
+    *lab.e++ = '#';		/* move whole line to 'label' buffer */
 
     {
 	bool in_comment = false;
-	int         com_start = 0;
-	char        quote = '\0';
-	int         com_end = 0;
+	int com_start = 0;
+	char quote = '\0';
+	int com_end = 0;
 
 	while (*buf_ptr == ' ' || *buf_ptr == '\t') {
 	    buf_ptr++;
@@ -1122,13 +1120,12 @@ process_preprocessing(void)
 	    lab.e--;
 	if (lab.e - lab.s == com_end && bp_save == NULL) {
 	    /* comment on preprocessor line */
-	    if (sc_end == NULL) {	/* if this is the first comment,
-						 * we must set up the buffer */
+	    if (sc_end == NULL) {	/* if this is the first comment, we
+					 * must set up the buffer */
 		save_com = sc_buf;
 		sc_end = &save_com[0];
 	    } else {
-		*sc_end++ = '\n';	/* add newline between
-						 * comments */
+		*sc_end++ = '\n';	/* add newline between comments */
 		*sc_end++ = ' ';
 		--line_no;
 	    }
@@ -1149,17 +1146,17 @@ process_preprocessing(void)
 	    debug_println("switched buf_ptr to save_com");
 	}
 	check_size_label(1);
-	*lab.e = '\0';	/* null terminate line */
+	*lab.e = '\0';		/* null terminate line */
 	ps.pcase = false;
     }
 
-    if (strncmp(lab.s, "#if", 3) == 0) { /* also ifdef, ifndef */
+    if (strncmp(lab.s, "#if", 3) == 0) {	/* also ifdef, ifndef */
 	if ((size_t)ifdef_level < nitems(state_stack)) {
 	    match_state[ifdef_level].tos = -1;
 	    state_stack[ifdef_level++] = ps;
 	} else
 	    diag(1, "#if stack overflow");
-    } else if (strncmp(lab.s, "#el", 3) == 0) { /* else, elif */
+    } else if (strncmp(lab.s, "#el", 3) == 0) {	/* else, elif */
 	if (ifdef_level <= 0)
 	    diag(1, lab.s[3] == 'i' ? "Unmatched #elif" : "Unmatched #else");
 	else {
@@ -1202,13 +1199,13 @@ main_loop(void)
     token_type ttype;
     bool force_nl;		/* when true, code must be broken */
     bool last_else = false;	/* true iff last keyword was an else */
-    int         dec_ind;	/* current indentation for declarations */
-    int         di_stack[20];	/* a stack of structure indentation levels */
+    int dec_ind;		/* current indentation for declarations */
+    int di_stack[20];		/* a stack of structure indentation levels */
     bool tabs_to_var;		/* true if using tabs to indent to var name */
     bool sp_sw;			/* when true, we are in the expression of
 				 * if(...), while(...), etc. */
-    token_type  hd_type = end_of_file; /* used to store type of stmt
-				 * for if (...), for (...), etc */
+    token_type hd_type = end_of_file;	/* used to store type of stmt for if
+					 * (...), for (...), etc */
     int squest;			/* when this is positive, we have seen a '?'
 				 * without the matching ':' in a <c>?<s>:<s>
 				 * construct */
@@ -1231,8 +1228,8 @@ main_loop(void)
 
 	/*
 	 * The following code moves newlines and comments following an if (),
-	 * while (), else, etc. up to the start of the following stmt to
-	 * a buffer. This allows proper handling of both kinds of brace
+	 * while (), else, etc. up to the start of the following stmt to a
+	 * buffer. This allows proper handling of both kinds of brace
 	 * placement (-br, -bl) and cuddling "else" (-ce).
 	 */
 	search_brace(&ttype, &force_nl, &comment_buffered, &last_else);
@@ -1249,7 +1246,7 @@ main_loop(void)
 		ttype != form_feed) {
 	    process_comment_in_code(ttype, &force_nl);
 
-	} else if (ttype != comment) /* preserve force_nl through a comment */
+	} else if (ttype != comment)	/* preserve force_nl through a comment */
 	    force_nl = false;	/* cancel forced newline after newline, form
 				 * feed, etc */
 
@@ -1320,15 +1317,15 @@ main_loop(void)
 
 	case switch_expr:	/* got keyword "switch" */
 	    sp_sw = true;
-	    hd_type = switch_expr; /* keep this for when we have seen the
-				 * expression */
+	    hd_type = switch_expr;	/* keep this for when we have seen the
+					 * expression */
 	    goto copy_id;	/* go move the token into buffer */
 
 	case keyword_for_if_while:
 	    sp_sw = true;	/* the interesting stuff is done after the
 				 * expression is scanned */
 	    hd_type = (*token.s == 'i' ? if_expr :
-		       (*token.s == 'w' ? while_expr : for_exprs));
+		(*token.s == 'w' ? while_expr : for_exprs));
 
 	    /* remember the type of header for later use by parser */
 	    goto copy_id;	/* copy the token into line */
@@ -1353,7 +1350,7 @@ main_loop(void)
 	case funcname:
 	case ident:		/* got an identifier or constant */
 	    process_ident(ttype, dec_ind, tabs_to_var, &sp_sw, &force_nl,
-			  hd_type);
+		hd_type);
     copy_id:
 	    copy_id();
 	    if (ttype != funcname)
@@ -1455,7 +1452,8 @@ indent_declaration(int cur_dec_ind, bool
     char *startpos = code.e;
 
     /*
-     * get the tab math right for indentations that are not multiples of tabsize
+     * get the tab math right for indentations that are not multiples of
+     * tabsize
      */
     if ((ps.ind_level * opt.indent_size) % opt.tabsize != 0) {
 	pos += (ps.ind_level * opt.indent_size) % opt.tabsize;
@@ -1507,7 +1505,7 @@ debug_println(const char *fmt, ...)
 
 void
 debug_vis_range(const char *prefix, const char *s, const char *e,
-		const char *suffix)
+    const char *suffix)
 {
     debug_printf("%s", prefix);
     for (const char *p = s; p < e; p++) {

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.66 src/usr.bin/indent/io.c:1.67
--- src/usr.bin/indent/io.c:1.66	Sat Sep 25 22:57:04 2021
+++ src/usr.bin/indent/io.c	Sun Sep 26 19:37:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.66 2021/09/25 22:57:04 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.67 2021/09/26 19:37:11 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)io.c	8.1 (Be
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.66 2021/09/25 22:57:04 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.67 2021/09/26 19:37:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -56,7 +56,7 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #include "indent.h"
 
 static bool comment_open;
-static int  paren_indent;
+static int paren_indent;
 
 static void
 output_char(char ch)
@@ -95,7 +95,7 @@ output_indent(int old_ind, int new_ind)
     }
 
     for (; ind < new_ind; ind++)
-        fputc(' ', output);
+	fputc(' ', output);
 
     debug_println("output_indent %d", ind);
     return ind;
@@ -137,9 +137,9 @@ dump_line(void)
 	    output_char('\n');
 	n_real_blanklines = 0;
 	if (ps.ind_level == 0)
-	    ps.ind_stmt = false;/* this is a class A kludge. don't do
-				 * additional statement indentation if we are
-				 * at bracket level 0 */
+	    ps.ind_stmt = false;	/* this is a class A kludge. don't do
+					 * additional statement indentation if
+					 * we are at bracket level 0 */
 
 	if (lab.e != lab.s || code.e != code.s)
 	    ps.stats.code_lines++;
@@ -155,9 +155,10 @@ dump_line(void)
 	    *lab.e = '\0';
 	    cur_col = 1 + output_indent(0, compute_label_indent());
 	    if (lab.s[0] == '#' && (strncmp(lab.s, "#else", 5) == 0
-				    || strncmp(lab.s, "#endif", 6) == 0)) {
+		    || strncmp(lab.s, "#endif", 6) == 0)) {
 		char *s = lab.s;
-		if (lab.e[-1] == '\n') lab.e--;
+		if (lab.e[-1] == '\n')
+		    lab.e--;
 		do {
 		    output_char(*s++);
 		} while (s < lab.e && 'a' <= *s && *s <= 'z');
@@ -168,13 +169,13 @@ dump_line(void)
 			output_char('\t');
 			output_range(s, lab.e);
 		    } else {
-		        output_string("\t/* ");
+			output_string("\t/* ");
 			output_range(s, lab.e);
 			output_string(" */");
 		    }
 		}
 	    } else
-	        output_range(lab.s, lab.e);
+		output_range(lab.s, lab.e);
 	    cur_col = 1 + indentation_after(cur_col - 1, lab.s);
 	} else
 	    cur_col = 1;	/* there is no label section */
@@ -208,13 +209,13 @@ dump_line(void)
 	    output_range(code.s, code.e);
 	    cur_col = 1 + indentation_after(cur_col - 1, code.s);
 	}
-	if (com.s != com.e) {		/* print comment, if any */
+	if (com.s != com.e) {	/* print comment, if any */
 	    int target_col = ps.com_col;
 	    char *com_st = com.s;
 
 	    target_col += ps.comment_delta;
 	    while (*com_st == '\t')	/* consider original indentation in
-				 * case this is a box comment */
+					 * case this is a box comment */
 		com_st++, target_col += opt.tabsize;
 	    while (target_col <= 0)
 		if (*com_st == ' ')
@@ -225,7 +226,7 @@ dump_line(void)
 		} else
 		    target_col = 1;
 	    if (cur_col > target_col) {	/* if comment can't fit on this line,
-				 * put it on next line */
+					 * put it on next line */
 		output_char('\n');
 		cur_col = 1;
 		ps.stats.lines++;
@@ -255,12 +256,14 @@ dump_line(void)
 	&& token.s < token.e && isspace((unsigned char)token.s[0]))
 	output_range(token.s, token.e);
 
-    ps.decl_on_line = ps.in_decl; /* if we are in the middle of a declaration,
-				 * remember that fact for proper comment
-				 * indentation */
-    ps.ind_stmt = ps.in_stmt && !ps.in_decl; /* next line should be indented if
-				 * we have not completed this stmt and if we
-				 * are not in the middle of a declaration */
+    ps.decl_on_line = ps.in_decl;	/* if we are in the middle of a
+					 * declaration, remember that fact for
+					 * proper comment indentation */
+    ps.ind_stmt = ps.in_stmt && !ps.in_decl;	/* next line should be
+						 * indented if we have not
+						 * completed this stmt and if
+						 * we are not in the middle of
+						 * a declaration */
     ps.use_ff = false;
     ps.dumped_decl_indent = false;
     *(lab.e = lab.s) = '\0';	/* reset buffers */
@@ -269,7 +272,7 @@ dump_line(void)
     ps.ind_level = ps.ind_level_follow;
     ps.paren_level = ps.p_l_follow;
     if (ps.paren_level > 0) {
-        /* TODO: explain what negative indentation means */
+	/* TODO: explain what negative indentation means */
 	paren_indent = -ps.paren_indents[ps.paren_level - 1];
 	debug_println("paren_indent is now %d", paren_indent);
     }
@@ -315,9 +318,9 @@ int
 compute_label_indent(void)
 {
     if (ps.pcase)
-	return (int) (case_ind * opt.indent_size);
+	return (int)(case_ind * opt.indent_size);
     if (lab.s[0] == '#')
-        return 0;
+	return 0;
     return opt.indent_size * (ps.ind_level - label_offset);
 }
 
@@ -344,7 +347,7 @@ parse_indent_comment(void)
     skip_hspace(&p);
 
     if (!(p[0] == 'I' && p[1] == 'N' && p[2] == 'D'
-	  && p[3] == 'E' && p[4] == 'N' && p[5] == 'T'))
+	    && p[3] == 'E' && p[4] == 'N' && p[5] == 'T'))
 	return;
     p += 6;
 
@@ -386,7 +389,8 @@ parse_indent_comment(void)
  */
 void
 fill_buffer(void)
-{				/* this routine reads stuff from the input */
+{
+    /* this routine reads stuff from the input */
     char *p;
     int i;
     FILE *f = input;

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.58 src/usr.bin/indent/lexi.c:1.59
--- src/usr.bin/indent/lexi.c:1.58	Sat Sep 25 22:14:21 2021
+++ src/usr.bin/indent/lexi.c	Sun Sep 26 19:37:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.58 2021/09/25 22:14:21 rillig Exp $	*/
+/*	$NetBSD: lexi.c,v 1.59 2021/09/26 19:37:11 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)lexi.c	8.1 (
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.58 2021/09/25 22:14:21 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.59 2021/09/26 19:37:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -115,8 +115,8 @@ const struct templ specials[] =
 };
 
 const char **typenames;
-int         typename_count;
-int         typename_top = -1;
+int typename_count;
+int typename_top = -1;
 
 /*
  * The transition table below was rewritten by hand from lx's output, given
@@ -337,19 +337,19 @@ static bool
 probably_typedef(const struct parser_state *state)
 {
     return state->p_l_follow == 0 && !state->block_init && !state->in_stmt &&
-	   ((*buf_ptr == '*' && buf_ptr[1] != '=') ||
-	    isalpha((unsigned char)*buf_ptr)) &&
-	   (state->last_token == semicolon || state->last_token == lbrace ||
-	    state->last_token == rbrace);
+	((*buf_ptr == '*' && buf_ptr[1] != '=') ||
+	isalpha((unsigned char)*buf_ptr)) &&
+	(state->last_token == semicolon || state->last_token == lbrace ||
+	state->last_token == rbrace);
 }
 
 /* Reads the next token, placing it in the global variable "token". */
 token_type
 lexi(struct parser_state *state)
 {
-    bool unary_delim;		/* whether the current token
-				 * forces a following operator to be unary */
-    token_type  ttype;
+    bool unary_delim;		/* whether the current token forces a
+				 * following operator to be unary */
+    token_type ttype;
 
     token.e = token.s;		/* point to start of place to save token */
     unary_delim = false;
@@ -382,7 +382,7 @@ lexi(struct parser_state *state)
 	*token.e = '\0';
 
 	if (token.s[0] == 'L' && token.s[1] == '\0' &&
-	      (*buf_ptr == '"' || *buf_ptr == '\''))
+	    (*buf_ptr == '"' || *buf_ptr == '\''))
 	    return lexi_end(string_prefix);
 
 	while (*buf_ptr == ' ' || *buf_ptr == '\t')	/* get rid of blanks */
@@ -390,8 +390,10 @@ lexi(struct parser_state *state)
 	state->keyword = rw_0;
 	if (state->last_token == keyword_struct_union_enum &&
 	    state->p_l_follow == 0) {
-	    /* if last token was 'struct' and we're not in parentheses, then
-	     * this token should be treated as a declaration */
+	    /*
+	     * if last token was 'struct' and we're not in parentheses, then
+	     * this token should be treated as a declaration
+	     */
 	    state->last_u_d = true;
 	    return lexi_end(decl);
 	}
@@ -407,14 +409,14 @@ lexi(struct parser_state *state)
 
 	    /* ... so maybe a type_t or a typedef */
 	    if ((opt.auto_typedefs && ((u = strrchr(token.s, '_')) != NULL) &&
-	        strcmp(u, "_t") == 0) || (typename_top >= 0 &&
-		  bsearch(token.s, typenames, (size_t)typename_top + 1,
-		    sizeof typenames[0], compare_string_array) != NULL)) {
+		    strcmp(u, "_t") == 0) || (typename_top >= 0 &&
+		    bsearch(token.s, typenames, (size_t)typename_top + 1,
+			sizeof typenames[0], compare_string_array) != NULL)) {
 		state->keyword = rw_type;
 		state->last_u_d = true;
-	        goto found_typename;
+		goto found_typename;
 	    }
-	} else {			/* we have a keyword */
+	} else {		/* we have a keyword */
 	    state->keyword = p->rwcode;
 	    state->last_u_d = true;
 	    switch (p->rwcode) {
@@ -475,7 +477,7 @@ lexi(struct parser_state *state)
 	if (state->last_token == decl)	/* if this is a declared variable,
 					 * then following sign is unary */
 	    state->last_u_d = true;	/* will make "int a -1" work */
-	return lexi_end(ident);		/* the ident is not in the list */
+	return lexi_end(ident);	/* the ident is not in the list */
     }				/* end of procesing for alpanum character */
 
     /* Scan a non-alphanumeric token */

Index: src/usr.bin/indent/parse.c
diff -u src/usr.bin/indent/parse.c:1.26 src/usr.bin/indent/parse.c:1.27
--- src/usr.bin/indent/parse.c:1.26	Sat Sep 25 20:56:53 2021
+++ src/usr.bin/indent/parse.c	Sun Sep 26 19:37:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.26 2021/09/25 20:56:53 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.27 2021/09/26 19:37:11 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -58,7 +58,7 @@ static void reduce(void);
 void
 parse(token_type ttype)
 {
-    int         i;
+    int i;
 
 #ifdef debug
     printf("parse token: '%s' \"%s\"\n", token_type_name(ttype), token.s);
@@ -85,8 +85,8 @@ parse(token_type ttype)
 	    ps.p_stack[++ps.tos] = decl;
 	    ps.il[ps.tos] = ps.ind_level_follow;
 
-	    if (opt.ljust_decl) {/* only do if we want left justified
-				 * declarations */
+	    if (opt.ljust_decl) {	/* only do if we want left justified
+					 * declarations */
 		ps.ind_level = 0;
 		for (i = ps.tos - 1; i > 0; --i)
 		    if (ps.p_stack[i] == decl)
@@ -101,8 +101,8 @@ parse(token_type ttype)
 	if (ps.p_stack[ps.tos] == if_expr_stmt_else && opt.else_if) {
 	    /*
 	     * Note that the stack pointer here is decremented, effectively
-	     * reducing "else if" to "if". This saves a lot of stack space
-	     * in case of a long "if-else-if ... else-if" sequence.
+	     * reducing "else if" to "if". This saves a lot of stack space in
+	     * case of a long "if-else-if ... else-if" sequence.
 	     */
 	    ps.ind_level_follow = ps.il[ps.tos--];
 	}
@@ -167,8 +167,9 @@ parse(token_type ttype)
 	else {
 	    ps.ind_level = ps.il[ps.tos];	/* indentation for else should
 						 * be same as for if */
-	    ps.ind_level_follow = ps.ind_level + 1; /* everything following
-				 * should be 1 level deeper */
+	    ps.ind_level_follow = ps.ind_level + 1;	/* everything following
+							 * should be 1 level
+							 * deeper */
 	    ps.p_stack[ps.tos] = if_expr_stmt_else;
 	    /* remember if with else */
 	    ps.search_brace = opt.btype_2 | opt.else_if;
@@ -220,7 +221,7 @@ parse(token_type ttype)
     for (i = 1; i <= ps.tos; ++i)
 	printf(" ('%s' at %d)", token_type_name(ps.p_stack[i]), ps.il[i]);
     if (ps.tos == 0)
-        printf(" empty");
+	printf(" empty");
     printf("\n");
 #endif
 }
@@ -238,17 +239,17 @@ reduce_stmt(void)
 {
     switch (ps.p_stack[ps.tos - 1]) {
 
-    case stmt:		/* stmt stmt */
-    case stmt_list:	/* stmt_list stmt */
+    case stmt:			/* stmt stmt */
+    case stmt_list:		/* stmt_list stmt */
 	ps.p_stack[--ps.tos] = stmt_list;
 	return true;
 
-    case keyword_do:	/* 'do' <stmt> */
+    case keyword_do:		/* 'do' <stmt> */
 	ps.p_stack[--ps.tos] = do_stmt;
 	ps.ind_level_follow = ps.il[ps.tos];
 	return true;
 
-    case if_expr:	/* 'if' '(' <expr> ')' <stmt> */
+    case if_expr:		/* 'if' '(' <expr> ')' <stmt> */
 	ps.p_stack[--ps.tos] = if_expr_stmt;
 	int i = ps.tos - 1;
 	while (ps.p_stack[i] != stmt &&
@@ -257,24 +258,24 @@ reduce_stmt(void)
 	    --i;
 	ps.ind_level_follow = ps.il[i];
 	/*
-	 * for the time being, we will assume that there is no else on
-	 * this if, and set the indentation level accordingly. If an
-	 * else is scanned, it will be fixed up later
+	 * for the time being, we will assume that there is no else on this
+	 * if, and set the indentation level accordingly. If an else is
+	 * scanned, it will be fixed up later
 	 */
 	return true;
 
-    case switch_expr:	/* 'switch' '(' <expr> ')' <stmt> */
+    case switch_expr:		/* 'switch' '(' <expr> ')' <stmt> */
 	case_ind = ps.cstk[ps.tos - 1];
 	/* FALLTHROUGH */
-    case decl:		/* finish of a declaration */
-    case if_expr_stmt_else: /* 'if' '(' <expr> ')' <stmt> 'else' <stmt> */
-    case for_exprs:	/* 'for' '(' ... ')' <stmt> */
-    case while_expr:	/* 'while' '(' <expr> ')' <stmt> */
+    case decl:			/* finish of a declaration */
+    case if_expr_stmt_else:	/* 'if' '(' <expr> ')' <stmt> 'else' <stmt> */
+    case for_exprs:		/* 'for' '(' ... ')' <stmt> */
+    case while_expr:		/* 'while' '(' <expr> ')' <stmt> */
 	ps.p_stack[--ps.tos] = stmt;
 	ps.ind_level_follow = ps.il[ps.tos];
 	return true;
 
-    default:		/* <anything else> <stmt> */
+    default:			/* <anything else> <stmt> */
 	return false;
     }
 }

Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.46 src/usr.bin/indent/pr_comment.c:1.47
--- src/usr.bin/indent/pr_comment.c:1.46	Sat Sep 25 22:14:21 2021
+++ src/usr.bin/indent/pr_comment.c	Sun Sep 26 19:37:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.46 2021/09/25 22:14:21 rillig Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.47 2021/09/26 19:37:11 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.46 2021/09/25 22:14:21 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.47 2021/09/26 19:37:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -81,19 +81,19 @@ check_size_comment(size_t desired_size)
 void
 process_comment(void)
 {
-    int         adj_max_line_length; /* Adjusted max_line_length for comments
-				 * that spill over the right margin */
+    int adj_max_line_length;	/* Adjusted max_line_length for comments that
+				 * spill over the right margin */
     ssize_t last_blank;		/* index of the last blank in com.buf */
-    char       *t_ptr;		/* used for moving string */
+    char *t_ptr;		/* used for moving string */
     bool break_delim = opt.comment_delimiter_on_blankline;
-    int         l_just_saw_decl = ps.just_saw_decl;
+    int l_just_saw_decl = ps.just_saw_decl;
 
     adj_max_line_length = opt.max_line_length;
     ps.just_saw_decl = 0;
     last_blank = -1;		/* no blanks found so far */
-    ps.box_com = false;		/* at first, assume that we are not in
-				 * a boxed comment or some other
-				 * comment that should not be touched */
+    ps.box_com = false;		/* at first, assume that we are not in a boxed
+				 * comment or some other comment that should
+				 * not be touched */
     ps.stats.comments++;
 
     /* Figure where to align and how to treat the comment */
@@ -109,10 +109,10 @@ process_comment(void)
 	    ps.box_com = true;	/* A comment with a '-' or '*' immediately
 				 * after the /+* is assumed to be a boxed
 				 * comment. A comment with a newline
-				 * immediately after the /+* is assumed to
-				 * be a block comment and is treated as a
-				 * box comment unless format_block_comments
-				 * is nonzero (the default). */
+				 * immediately after the /+* is assumed to be
+				 * a block comment and is treated as a box
+				 * comment unless format_block_comments is
+				 * nonzero (the default). */
 	    break_delim = false;
 	}
 	if (lab.s == lab.e && code.s == code.e) {
@@ -136,7 +136,7 @@ process_comment(void)
 	    if (ps.com_col <= target_col)
 		ps.com_col = opt.tabsize * (1 + (target_col - 1) / opt.tabsize) + 1;
 	    if (ps.com_col + 24 > adj_max_line_length)
-	        /* XXX: mismatch between column and length */
+		/* XXX: mismatch between column and length */
 		adj_max_line_length = ps.com_col + 24;
 	}
     }
@@ -177,11 +177,11 @@ process_comment(void)
 	    if (t_ptr >= buf_end)
 		fill_buffer();
 	    if (t_ptr[0] == '*' && t_ptr[1] == '/') {
-	        /*
-	         * XXX: This computation ignores the leading " * ", as well
-	         * as the trailing ' ' '*' '/'.  In simple cases, these cancel
-	         * out since they are equally long.
-	         */
+		/*
+		 * XXX: This computation ignores the leading " * ", as well as
+		 * the trailing ' ' '*' '/'.  In simple cases, these cancel
+		 * out since they are equally long.
+		 */
 		int right_margin = indentation_after_range(ps.com_col - 1,
 		    buf_ptr, t_ptr + 2);
 		if (right_margin < adj_max_line_length)
@@ -191,7 +191,7 @@ process_comment(void)
 	}
 
     if (break_delim) {
-	char       *t = com.e;
+	char *t = com.e;
 	com.e = com.s + 2;
 	*com.e = 0;
 	if (opt.blanklines_before_blockcomments && ps.last_token != lbrace)
@@ -257,7 +257,7 @@ process_comment(void)
 	    }
 	    ++line_no;		/* keep track of input line number */
 	    if (!ps.box_com) {
-		int         nstar = 1;
+		int nstar = 1;
 		do {		/* flush any blanks and/or tabs at start of
 				 * next line */
 		    if (++buf_ptr >= buf_end)
@@ -309,7 +309,8 @@ process_comment(void)
 		if (buf_ptr >= buf_end)
 		    fill_buffer();
 		if (*com.e == ' ' || *com.e == '\t')
-		    last_blank = com.e - com.buf; /* remember we saw a blank */
+		    last_blank = com.e - com.buf;	/* remember we saw a
+							 * blank */
 		++com.e;
 		now_len++;
 	    } while (memchr("*\n\r\b\t", *buf_ptr, 6) == NULL &&
@@ -338,8 +339,8 @@ process_comment(void)
 		last_blank = -1;
 		/*
 		 * t_ptr will be somewhere between com.e (dump_line() reset)
-		 * and com.l. So it's safe to copy byte by byte from t_ptr
-		 * to com.e without any check_size_comment().
+		 * and com.l. So it's safe to copy byte by byte from t_ptr to
+		 * com.e without any check_size_comment().
 		 */
 		while (*t_ptr != '\0') {
 		    if (*t_ptr == ' ' || *t_ptr == '\t')

Reply via email to