I installed indent
using brew
thanks to the command brew install gnu-indent
so now I have gnu-indent-2.2.10
installed on my MacOS X so far, so good. My problem is when I want to indent a file using GNU
code style.
I mean I would like to convert this:
while (foo) {
}
Into this:
while (foo)
{
}
So following the documentation I launched indent
with the parameter -bl -bli2
in order to have the GNU code style with 2 spaces by which braces are indented but what I actually get is:
while (foo)
{
}
It is like, I used -bl -bli0
whatever I put after -bli
, I get the same result.
In other words assuming that the content of test.c
is:
while (foo) {
}
If I launch indent test.c -st -bl -bli2 > test.out
, test.out
is then on my side:
while (foo)
{
}
Do I miss something or it is a bug in GNU indent
?
Update:
It appears to be Mac OS X
related, because it works as expected on Debian 8
with GNU indent 2.2.11
and on Ubuntu 14.04
with GNU indent
2.2.11
and 2.2.10-2
.
I finally realized that I don't use the indent
version from brew but from XCode
, the problem comes from the version of XCode
that doesn't work like GNU indent
. If I launch the same command with gindent
instead of indent
it works as expected. I mean If I launch gindent test.c -st -bl -bli2 > test.out
, I get what is expected:
while (foo)
{
}