Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/indent indent: list options in the same order as in ...
details: https://anonhg.NetBSD.org/src/rev/868a6aa00a3a
branches: trunk
changeset: 1023816:868a6aa00a3a
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Sep 26 20:21:47 2021 +0000
description:
indent: list options in the same order as in the manual page
No functional change.
diffstat:
usr.bin/indent/args.c | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
diffs (97 lines):
diff -r 816317b1f451 -r 868a6aa00a3a usr.bin/indent/args.c
--- a/usr.bin/indent/args.c Sun Sep 26 20:15:04 2021 +0000
+++ b/usr.bin/indent/args.c Sun Sep 26 20:21:47 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: args.c,v 1.35 2021/09/26 20:12:37 rillig Exp $ */
+/* $NetBSD: args.c,v 1.36 2021/09/26 20:21:47 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.35 2021/09/26 20:12:37 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.36 2021/09/26 20:21:47 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
#endif
@@ -83,11 +83,10 @@
bool_option("n" name, false, var)
/*
- * N.B.: because of the way the table here is scanned, options whose names are
- * a prefix of other options must occur later; that is, with -lp vs -l, -lp
- * must be first and -l must be last.
+ * N.B.: an option whose name is a prefix of another option must come earlier;
+ * for example, "l" must come before "lp".
*
- * See also set_special_option.
+ * See set_special_option for special options.
*/
static const struct pro {
const char p_name[6]; /* name, e.g. "bl", "cli" */
@@ -96,41 +95,47 @@
void *p_obj; /* the associated variable (bool, int) */
} pro[] = {
bool_options("bacc", opt.blanklines_around_conditional_compilation),
+ bool_options("bad", opt.blanklines_after_declarations),
bool_options("badp", opt.blanklines_after_declarations_at_proctop),
- bool_options("bad", opt.blanklines_after_declarations),
bool_options("bap", opt.blanklines_after_procs),
bool_options("bbb", opt.blanklines_before_blockcomments),
bool_options("bc", opt.break_after_comma),
bool_option("bl", false, opt.btype_2),
bool_option("br", true, opt.btype_2),
bool_options("bs", opt.blank_after_sizeof),
+ int_option("c", opt.comment_column),
+ int_option("cd", opt.decl_comment_column),
bool_options("cdb", opt.comment_delimiter_on_blankline),
- int_option("cd", opt.decl_comment_column),
bool_options("ce", opt.cuddle_else),
int_option("ci", opt.continuation_indent),
+ /* "cli" is special */
bool_options("cs", opt.space_after_cast),
- int_option("c", opt.comment_column),
+ int_option("d", opt.unindent_displace),
int_option("di", opt.decl_indent),
bool_options("dj", opt.ljust_decl),
- int_option("d", opt.unindent_displace),
bool_options("eei", opt.extra_expression_indent),
bool_options("ei", opt.else_if),
bool_options("fbs", opt.function_brace_split),
bool_options("fc1", opt.format_col1_comments),
bool_options("fcb", opt.format_block_comments),
+ int_option("i", opt.indent_size),
bool_options("ip", opt.indent_parameters),
- int_option("i", opt.indent_size),
+ int_option("l", opt.max_line_length),
int_option("lc", opt.block_comment_max_line_length),
int_option("ldi", opt.local_decl_indent),
+ bool_options("lp", opt.lineup_to_parens),
bool_options("lpl", opt.lineup_to_parens_always),
- bool_options("lp", opt.lineup_to_parens),
- int_option("l", opt.max_line_length),
+ /* "npro" is special */
+ /* "P" is special */
bool_options("pcs", opt.proc_calls_space),
bool_options("psl", opt.procnames_start_line),
bool_options("sc", opt.star_comment_cont),
bool_options("sob", opt.swallow_optional_blanklines),
+ /* "st" is special */
bool_option("ta", true, opt.auto_typedefs),
+ /* "T" is special */
int_option("ts", opt.tabsize),
+ /* "U" is special */
bool_options("ut", opt.use_tabs),
bool_options("v", opt.verbose),
};
@@ -269,7 +274,7 @@
if (set_special_option(arg))
return;
- for (p = pro; p != pro + nitems(pro); p++)
+ for (p = pro + nitems(pro); p-- != pro; )
if (p->p_name[0] == arg[0])
if ((param_start = skip_over(arg, p->p_name)) != NULL)
goto found;
Home |
Main Index |
Thread Index |
Old Index