Module Name: src
Committed By: rillig
Date: Sun Sep 26 20:21:47 UTC 2021
Modified Files:
src/usr.bin/indent: args.c
Log Message:
indent: list options in the same order as in the manual page
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.bin/indent/args.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.35 src/usr.bin/indent/args.c:1.36
--- src/usr.bin/indent/args.c:1.35 Sun Sep 26 20:12:37 2021
+++ src/usr.bin/indent/args.c Sun Sep 26 20:21:47 2021
@@ -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 @@ static char sccsid[] = "@(#)args.c 8.1 (
#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 @@ static const char *option_source = "?";
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 @@ static const struct pro {
void *p_obj; /* the associated variable (bool, int) */
} pro[] = {
bool_options("bacc", opt.blanklines_around_conditional_compilation),
- bool_options("badp", opt.blanklines_after_declarations_at_proctop),
bool_options("bad", opt.blanklines_after_declarations),
+ bool_options("badp", opt.blanklines_after_declarations_at_proctop),
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),
- bool_options("cdb", opt.comment_delimiter_on_blankline),
+ int_option("c", opt.comment_column),
int_option("cd", opt.decl_comment_column),
+ bool_options("cdb", opt.comment_delimiter_on_blankline),
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),
- bool_options("ip", opt.indent_parameters),
int_option("i", opt.indent_size),
+ bool_options("ip", opt.indent_parameters),
+ 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("lpl", opt.lineup_to_parens_always),
bool_options("lp", opt.lineup_to_parens),
- int_option("l", opt.max_line_length),
+ bool_options("lpl", opt.lineup_to_parens_always),
+ /* "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 @@ set_option(const char *arg)
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;