Deleted Added
full compact
indent.c (125631) indent.c (125633)
1/*
2 * Copyright (c) 1985 Sun Microsystems, Inc.
3 * Copyright (c) 1976 Board of Trustees of the University of Illinois.
4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 34 unchanged lines hidden (view full) ---

43
44#if 0
45#ifndef lint
46static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6/7/93";
47#endif /* not lint */
48#endif
49
50#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1985 Sun Microsystems, Inc.
3 * Copyright (c) 1976 Board of Trustees of the University of Illinois.
4 * Copyright (c) 1980, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 34 unchanged lines hidden (view full) ---

43
44#if 0
45#ifndef lint
46static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6/7/93";
47#endif /* not lint */
48#endif
49
50#include <sys/cdefs.h>
51__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 125631 2004-02-09 20:42:08Z bde $");
51__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 125633 2004-02-09 21:48:51Z bde $");
52
53#include <sys/param.h>
54#include <err.h>
55#include <fcntl.h>
56#include <unistd.h>
57#include <stdio.h>
58#include <stdlib.h>
59#include <string.h>

--- 103 unchanged lines hidden (view full) ---

163 max_col = 78; /* -l78 */
164 lineup_to_parens = 1; /* -lp */
165 ps.ljust_decl = 0; /* -ndj */
166 ps.com_ind = 33; /* -c33 */
167 star_comment_cont = 1; /* -sc */
168 ps.ind_size = 8; /* -i8 */
169 verbose = 0;
170 ps.decl_indent = 16; /* -di16 */
52
53#include <sys/param.h>
54#include <err.h>
55#include <fcntl.h>
56#include <unistd.h>
57#include <stdio.h>
58#include <stdlib.h>
59#include <string.h>

--- 103 unchanged lines hidden (view full) ---

163 max_col = 78; /* -l78 */
164 lineup_to_parens = 1; /* -lp */
165 ps.ljust_decl = 0; /* -ndj */
166 ps.com_ind = 33; /* -c33 */
167 star_comment_cont = 1; /* -sc */
168 ps.ind_size = 8; /* -i8 */
169 verbose = 0;
170 ps.decl_indent = 16; /* -di16 */
171 ps.local_decl_indent = -1; /* if this is not set to some nonnegative value
172 * by an arg, we will set this equal to
173 * ps.decl_ind */
171 ps.indent_parameters = 1; /* -ip */
172 ps.decl_com_ind = 0; /* if this is not set to some positive value
173 * by an arg, we will set this equal to
174 * ps.com_ind */
175 btype_2 = 1; /* -br */
176 cuddle_else = 1; /* -ce */
177 ps.unindent_displace = 0; /* -d0 */
178 ps.case_indent = 0; /* -cli0 */

--- 70 unchanged lines hidden (view full) ---

249 writefdef(&scomf, 'C');
250 writefdef(&blkcomf, 'L');
251 writefdef(&boxcomf, 'X');
252 writefdef(&stringf, 'S');
253 writefdef(&keywordf, 'K');
254 }
255 if (block_comment_max_col <= 0)
256 block_comment_max_col = max_col;
174 ps.indent_parameters = 1; /* -ip */
175 ps.decl_com_ind = 0; /* if this is not set to some positive value
176 * by an arg, we will set this equal to
177 * ps.com_ind */
178 btype_2 = 1; /* -br */
179 cuddle_else = 1; /* -ce */
180 ps.unindent_displace = 0; /* -d0 */
181 ps.case_indent = 0; /* -cli0 */

--- 70 unchanged lines hidden (view full) ---

252 writefdef(&scomf, 'C');
253 writefdef(&blkcomf, 'L');
254 writefdef(&boxcomf, 'X');
255 writefdef(&stringf, 'S');
256 writefdef(&keywordf, 'K');
257 }
258 if (block_comment_max_col <= 0)
259 block_comment_max_col = max_col;
260 if (ps.local_decl_indent < 0) /* if not specified by user, set this */
261 ps.local_decl_indent = ps.decl_indent;
257 if (ps.decl_com_ind <= 0) /* if not specified by user, set this */
258 ps.decl_com_ind = ps.ljust_decl ? (ps.com_ind <= 10 ? 2 : ps.com_ind - 8) : ps.com_ind;
259 if (continuation_indent == 0)
260 continuation_indent = ps.ind_size;
261 fill_buffer(); /* get first batch of stuff into input buffer */
262
263 parse(semicolon);
264 {

--- 636 unchanged lines hidden (view full) ---

901 ps.in_or_st = true; /* this might be a structure or initialization
902 * declaration */
903 ps.in_decl = ps.decl_on_line = true;
904 if ( /* !ps.in_or_st && */ ps.dec_nest <= 0)
905 ps.just_saw_decl = 2;
906 prefix_blankline_requested = 0;
907 for (i = 0; token[i++];); /* get length of token */
908
262 if (ps.decl_com_ind <= 0) /* if not specified by user, set this */
263 ps.decl_com_ind = ps.ljust_decl ? (ps.com_ind <= 10 ? 2 : ps.com_ind - 8) : ps.com_ind;
264 if (continuation_indent == 0)
265 continuation_indent = ps.ind_size;
266 fill_buffer(); /* get first batch of stuff into input buffer */
267
268 parse(semicolon);
269 {

--- 636 unchanged lines hidden (view full) ---

906 ps.in_or_st = true; /* this might be a structure or initialization
907 * declaration */
908 ps.in_decl = ps.decl_on_line = true;
909 if ( /* !ps.in_or_st && */ ps.dec_nest <= 0)
910 ps.just_saw_decl = 2;
911 prefix_blankline_requested = 0;
912 for (i = 0; token[i++];); /* get length of token */
913
909 dec_ind = ps.decl_indent > 0 ? ps.decl_indent : i;
910 use_tabs = ps.decl_indent > 0;
914 if (ps.ind_level == 0 || ps.dec_nest > 0) {
915 /* global variable or struct member in local variable */
916 dec_ind = ps.decl_indent > 0 ? ps.decl_indent : i;
917 use_tabs = ps.decl_indent > 0;
918 } else {
919 /* local variable */
920 dec_ind = ps.local_decl_indent > 0 ? ps.local_decl_indent : i;
921 use_tabs = ps.local_decl_indent > 0;
922 }
911 goto copy_id;
912
913 case ident: /* got an identifier or constant */
914 if (ps.in_decl) { /* if we are in a declaration, we must indent
915 * identifier */
916 if (is_procname == 0 || !procnames_start_line) {
917 if (!ps.block_init) {
918 if (troff && !ps.dumped_decl_indent) {

--- 285 unchanged lines hidden ---
923 goto copy_id;
924
925 case ident: /* got an identifier or constant */
926 if (ps.in_decl) { /* if we are in a declaration, we must indent
927 * identifier */
928 if (is_procname == 0 || !procnames_start_line) {
929 if (!ps.block_init) {
930 if (troff && !ps.dumped_decl_indent) {

--- 285 unchanged lines hidden ---