diff --git a/usr.bin/indent/args.c b/usr.bin/indent/args.c index 0df2f790b118..4d4cc32373a0 100644 --- a/usr.bin/indent/args.c +++ b/usr.bin/indent/args.c @@ -255,7 +255,7 @@ set_defaults(void) * Because ps.case_indent is a float, we can't initialize it from the * table: */ - ps.case_indent = 0.0; /* -cli0.0 */ + opt.case_indent = 0.0; /* -cli0.0 */ for (p = pro; p->p_name; p++) if (p->p_type != PRO_SPECIAL) *p->p_obj = p->p_default; @@ -284,7 +284,7 @@ set_option(char *arg) case CLI: if (*param_start == 0) goto need_param; - ps.case_indent = atof(param_start); + opt.case_indent = atof(param_start); break; case STDIN: diff --git a/usr.bin/indent/indent_globs.h b/usr.bin/indent/indent_globs.h index 8868a96253a7..479fd2dd7a38 100644 --- a/usr.bin/indent/indent_globs.h +++ b/usr.bin/indent/indent_globs.h @@ -165,6 +165,8 @@ struct options { int cuddle_else; /* true if else should cuddle up to '}' */ int continuation_indent; /* set to the indentation between the * edge of code and continuation lines */ + float case_indent; /* The distance to indent case labels from the + * switch statement */ int com_ind; /* the column in which comments to the right * of code should start */ int decl_indent; /* column to indent declared identifiers to */ @@ -304,8 +306,6 @@ struct parser_state { * ignored in some cases.) */ int keyword; /* the type of a keyword or 0 */ int dumped_decl_indent; - float case_indent; /* The distance to indent case labels from the - * switch statement */ int in_parameter_declaration; int tos; /* pointer to top of stack */ char procname[100]; /* The name of the current procedure */ diff --git a/usr.bin/indent/parse.c b/usr.bin/indent/parse.c index 48bf94a47244..faf403cc0d7d 100644 --- a/usr.bin/indent/parse.c +++ b/usr.bin/indent/parse.c @@ -128,7 +128,7 @@ parse(int tk) /* tk: the code for the construct scanned */ /* * it is a group as part of a while, for, etc. */ - if (ps.p_stack[ps.tos] == swstmt && ps.case_indent >= 1) + if (ps.p_stack[ps.tos] == swstmt && opt.case_indent >= 1) --ps.ind_level; /* * for a switch, brace should be two levels out from the code @@ -189,10 +189,10 @@ parse(int tk) /* tk: the code for the construct scanned */ ps.cstk[ps.tos] = case_ind; /* save current case indent level */ ps.il[ps.tos] = ps.i_l_follow; - case_ind = ps.i_l_follow + ps.case_indent; /* cases should be one + case_ind = ps.i_l_follow + opt.case_indent; /* cases should be one * level down from * switch */ - ps.i_l_follow += ps.case_indent + 1; /* statements should be two + ps.i_l_follow += opt.case_indent + 1; /* statements should be two * levels in */ ps.search_brace = opt.btype_2; break;