There exist multi-platform programs that check indent's version in order to
know what they can expect from it. GNU indent provides that via --version,
so implement the same option here.
With -lpl, code surrounded by parentheses in continuation lines is lined up
even if it would extend past the right margin.
With -nlpl (the default), such a line that would extend past the right
margin is moved left to keep it within the margin, if that does not require
placing it to the left of the prevailing indentation level.
These switches have no effect if -nlp is selected.
Submitted by: Tom Lane
With -lp, if a line has an opening paren which is not closed on that line,
then continuation lines will be lined up to start at the character position
just after the opening paren.
Submitted by: Tom Lane
The troff output in indent was invented at Sun and the online documentation
for some post-SunOS operating system includes this:
The usual way to get a troffed listing is with the command
indent -troff program.c | troff -mindent
The indent manual page in FreeBSD 1.0 already lacks that information and
troff -mindent complains about not being able to find the macro file.
It seems that the file did exist on SunOS and was supposed to be imported
into 4.3BSD together with the feature, but that has never happened.
Removal of troff output support simplifies a lot of indent's code.
vgrind(1) seems to be a promising replacement.
Instead of using a non-configurable ".BAK" suffix, respect the
SIMPLE_BACKUP_SUFFIX environment variable also used by patch(1). This
simplifies cleanup operations in some patch/indent workflows.
Reviewed by: cem (earlier version), emaste, pstef
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D10921
Without this change, indent(1) would only look to load options from ~/.indent.pro if it's there and -npro wasn't used on the command line. This option lets the user set their own path to the file.
Approved by: pfg (mentor)
Differential Revision: https://reviews.freebsd.org/D9010
Add -sac (space after cast) and -nsac options.
These control whether space character is put after a cast operator or not.
Default is -nsac.
Add -U option for providing a file containing list of types.
This is needed for properly deciding which asterisks denote unary
operation and which denote binary.
These come from PostgreSQL.
Reference:
84b00e3d4649c52cf383
Differential Revision: https://reviews.freebsd.org/D6966 (Partial)
Submitted by: Piotr Stefaniak
parentheses if the continuation indent is exactly half of the main
indent. Indenting one contination indent for every level of
parentheses gives bad results in most cases and is not what is done
in about 90% of properly hand-formatted KNF code (sys/kern/*.c,
nvi/common/*.c). The main advantage of the non-default KNF options
-nlp -ci4 is that continuation lines don't accidentally line up with
the next main indentation level or march to the right, and increasing
their indentation defeats this.
This behaviour change is limited to when the continuation indent is
exactly half of the main indent to avoid adding yet another option.
The default is to be backwards compatible and non-KNF (use the same
indentation for locals as for globals; -ldi0 gives KNF indentation
for locals (none)). The indentation for globals also applies to struct
member names in local declatations. The indentation of variable names
in multi-line declarations is broken in various ways and this commit
gives some new variations.
indent.1:
Also clarified the description of -di<N>.
track.
The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;
.\" $Id$
.\"
If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.
Approved by: bde