[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How do I avoid extra indention?
From: |
David Thompson |
Subject: |
How do I avoid extra indention? |
Date: |
Tue, 14 Nov 2006 23:20:53 -0800 (PST) |
Greetings,
I'm having some trouble understanding the plethora of options
available for GNU indent.
Except for the function's opening {, I want all code to line
up under the opening { of the block it resides in.
Let me explain with an example. I'm using this command,
gindent -npro -kr -bl -bli4 -nce < ncmp.c > ncmp2.c
and ncmp2.c is neatly formatted like this,
int32_t dcrp_oidncmp(dcroid_t * a, dcroid_t * b, size_t n)
{
size_t i;
size_t szA = OID_LEN(a);
size_t szB = OID_LEN(b);
if (n == 0)
{
return 0;
}
else if (szB == 0)
{
return 1;
}
else
{
for (i = 0; i < n && i < szA && i < szB; i++)
{
if (OID_AT(a, i) > OID_AT(b, i))
return 1;
else if (OID_AT(a, i) < OID_AT(b, i))
return -1;
}
return 0;
}
}
However, notice the extra indention of code for inner blocks;
I want output to omit that extra indention, like this output,
int32_t dcrp_oidncmp(dcroid_t * a, dcroid_t * b, size_t n)
{
size_t i;
size_t szA = OID_LEN(a);
size_t szB = OID_LEN(b);
if (n == 0)
{
return 0;
}
else if (szB == 0)
{
return 1;
}
else
{
for (i = 0; i < n && i < szA && i < szB; i++)
{
if (OID_AT(a, i) > OID_AT(b, i))
return 1;
else if (OID_AT(a, i) < OID_AT(b, i))
return -1;
}
return 0;
}
}
Except for the function's opening {, all code is lined up
under the opening { of the block it resides in.
I don't seem to see any options that turn off this extra
indent. How do I do this? Any ideas?
Regards,
David
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- How do I avoid extra indention?,
David Thompson <=