How do I avoid extra indention?

David Thompson <[email protected]>
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.