summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2004-02-09 20:42:08 +0000
committerBruce Evans <bde@FreeBSD.org>2004-02-09 20:42:08 +0000
commit7b3b38c6db5001f7badbbdb40b843dbca6e78735 (patch)
treeb735332538fc49c228cec05cdd662781f6ec6408
parent38efe50cbd84b6f3f75ed83e0e8b3665a524575e (diff)
Notes
-rw-r--r--usr.bin/indent/indent.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c
index bc132dcefcfb..ba7d463a8459 100644
--- a/usr.bin/indent/indent.c
+++ b/usr.bin/indent/indent.c
@@ -91,6 +91,7 @@ main(int argc, char **argv)
int squest; /* when this is positive, we have seen a ?
* without the matching : in a <c>?<s>:<s>
* construct */
+ int use_tabs; /* true if using tabs to indent to var name */
const char *t_ptr; /* used for copying tokens */
int type_code; /* the type of token, returned by lexi */
@@ -905,11 +906,8 @@ check_type:
prefix_blankline_requested = 0;
for (i = 0; token[i++];); /* get length of token */
- /*
- * dec_ind = e_code - s_code + (ps.decl_indent>i ? ps.decl_indent
- * : i);
- */
dec_ind = ps.decl_indent > 0 ? ps.decl_indent : i;
+ use_tabs = ps.decl_indent > 0;
goto copy_id;
case ident: /* got an identifier or constant */
@@ -929,10 +927,12 @@ check_type:
startpos = e_code - s_code;
pos = startpos;
- while ((pos & ~7) + 8 <= dec_ind) {
- CHECK_SIZE_CODE;
- *e_code++ = '\t';
- pos = (pos & ~7) + 8;
+ if (use_tabs) {
+ while ((pos & ~7) + 8 <= dec_ind) {
+ CHECK_SIZE_CODE;
+ *e_code++ = '\t';
+ pos = (pos & ~7) + 8;
+ }
}
while (pos < dec_ind) {
CHECK_SIZE_CODE;