bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Linux Indent Utility not working as expected ..


From: Vipin Garg
Subject: Linux Indent Utility not working as expected ..
Date: Thu, 1 Sep 2016 13:31:55 -0700

Hello,



I am using “indent” utility to align my C code. I am using “Package
indent-2.2.11-6.fc17.x86_64” package   with following options –



*indent -linux -l120 -ut -nbad -bap -nbc -bbo -hnl -bl -bli0 -ci4 -cli0 -d0
-di4 -nfc1 -i4 -ip0 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob
-nfca -cp33 -ss -ts4 -il4 <file_name.c>*



With this, some portion of the code is not getting formatted correctly  -



1.       I have some old fashion C  code like this -



*    static struct test__11__ = {*

*        set:   1_set,*

*        unset: 2_unset,*

*    }, intaaa_type_oper = {*

*        set:   1_reject,*

*        unset: 2_reject,*

*        parse: 3_parse,*

*    }, intaaa_bb_cccc = {*

*        set:    1_change,*

*        parse:  2_parse,*

*    }, intccc_xx_t_oper = {*

*        check:  11_check,*

*        help:   12_help,*

*    }, vk_12_opers = {*

*        check: 123_check,*

*        help:  234_help,*

*    }, avc_12_opers = {*

*        help:  12_help,*

*        parse: 23_parse,*

*        save:  34_save,*

*        check: 45_check,*

*        print: 56_print,*

*        set:   aa11_set,*

*        unset: 123_unset,*

*        skip:  123_skip,*

*    }, untagged_vlan_opers = {*



*}..*



After I run “indent” with above option , it becomes (As shown below)  where
as I want to  keep it the look-and-feel the same way as above with
tabs/spaces and  outer open/close braces  aligned  ..

============================

    static struct test_11_ = {

    set:1_set,

    unset:2_unset,

    }, intaaa_type_oper =

    {

    set: 1_reject, unset: 2_reject, parse:3_parse,}, intaaa_bb_cccc =

    {

    set: 1_change, parse:1_parse,}, intccc_xx_t_oper =

    {

    check: 11_check, help:swintf_lg_timeout_help,}, vk_12_opers =

    {

    check: 123_check, help:234_help,}, avc_12_opers =

    {

    help: 12_help, parse: 23_parse, save: 34_save, check: 45_check, print:
56_print, set: aa11_set, unset: 123_unset, skip:123_skip,},

        123_abc_opers

        =

    {



}....

==========================



2.       Another C code that is not coming out correctly  is ..

    int_123_t 123_enable[]={

        {"disable", "ABC ....", 1_DISABLE, sizeof(char), },

        {"enable",  "XYZ.....", 1_ENABLE,  sizeof(char), },

        {"may-be",  "EFG.....", 1_MAY_BE, sizeof(int), },

    };



After I run “indent” with above option , it becomes (As shown below)  where
as I want to  keep it the look-and-feel the same way as above with
tabs/spaces and  outer open/close braces  aligned  ..

=======



   int_option_t 123_enable[] = {

        {"disable", "ABC .....", 1_DISABLE, sizeof(char),}

        ,

        {"enable", "XYZ.......", 2_ENABLE, sizeof(char),}

        ,

        {"may-be", "EFC.......", 3_ENABLE,

         sizeof(int),}

        ,

    };



====



Thanks

Vipin Garg


reply via email to

[Prev in Thread] Current Thread [Next in Thread]