how to suppress "indent" from performing functions not specified in the options?

Discussion in 'C Programming' started by Divya, Jul 27, 2007.

  1. Divya

    Divya Guest

    I want to use indent to selectively format some code anomalies. For
    example, braces after if, etc. But, when I use the indent progam with -
    bl option, it does other things as well and changes the whole source
    code to some coding style. It's probably the GNU coding style. But, I
    want only the "braces after if" to be fixed and rest of the source
    code to be untouched. How can this be done?
     
    Divya, Jul 27, 2007
    #1
    1. Advertising

  2. Divya said:

    > I want to use indent to selectively format some code anomalies.


    Why are you asking in comp.lang.c? Perhaps comp.unix.programmer or
    comp.os.linux.development.apps would be a better starting point.

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
     
    Richard Heathfield, Jul 27, 2007
    #2
    1. Advertising

  3. Divya

    Tim Prince Guest

    Re: how to suppress "indent" from performing functions not specifiedin the options?

    Richard Heathfield wrote:
    > Divya said:
    >
    >> I want to use indent to selectively format some code anomalies.

    >
    > Why are you asking in comp.lang.c? Perhaps comp.unix.programmer or
    > comp.os.linux.development.apps would be a better starting point.
    >

    What about using indent on Windows, as I usually do, even though I work
    more often on linux? Here, at least, a response was elicited.
     
    Tim Prince, Jul 27, 2007
    #3
  4. Tim Prince said:

    > Richard Heathfield wrote:
    >> Divya said:
    >>
    >>> I want to use indent to selectively format some code anomalies.

    >>
    >> Why are you asking in comp.lang.c? Perhaps comp.unix.programmer or
    >> comp.os.linux.development.apps would be a better starting point.
    >>

    > What about using indent on Windows, as I usually do, even though I
    > work
    > more often on linux?


    Whoops! You're quite right. I should have been more general in my reply.
    My apologies to the OP. (Indeed, a glance at the article's headers
    suggests that the OP is indeed using Windows, although it's hard to be
    certain nowadays.) So I should add comp.os.ms-windows.programmer.win32
    to the mix, I guess.

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
     
    Richard Heathfield, Jul 27, 2007
    #4
  5. Divya <> wrote:
    > I want to use indent to selectively format some code anomalies. For
    > example, braces after if, etc. But, when I use the indent progam with -
    > bl option, it does other things as well and changes the whole source
    > code to some coding style. It's probably the GNU coding style. But, I
    > want only the "braces after if" to be fixed and rest of the source
    > code to be untouched. How can this be done?


    short - you can't, because indent writes a completely new version of the
    file, token-by-token. The best you can achieve with it is to setup
    options with indent to closely match what you want, and use the *INDENT-ON*
    and *INDENT-OFF* comments to block out changes to lines that you do not
    want altered.

    --
    Thomas E. Dickey
    http://invisible-island.net
    ftp://invisible-island.net
     
    Thomas Dickey, Jul 27, 2007
    #5
  6. Divya

    CBFalconer Guest

    Re: how to suppress "indent" from performing functions not specified inthe options?

    Richard Heathfield wrote:
    > Tim Prince said:
    >> Richard Heathfield wrote:
    >>> Divya said:
    >>>
    >>>> I want to use indent to selectively format some code anomalies.
    >>>
    >>> Why are you asking in comp.lang.c? Perhaps comp.unix.programmer or
    >>> comp.os.linux.development.apps would be a better starting point.
    >>>

    >> What about using indent on Windows, as I usually do, even though I
    >> work more often on linux?

    >
    > Whoops! You're quite right. I should have been more general in my
    > reply. My apologies to the OP. (Indeed, a glance at the article's
    > headers suggests that the OP is indeed using Windows, although it's
    > hard to be certain nowadays.) So I should add
    > comp.os.ms-windows.programmer.win32 to the mix, I guess.


    Try comp.os.msdos.djgpp for a DOS version that will run happily
    under Windoze.

    --
    <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
    <http://www.securityfocus.com/columnists/423>
    <http://www.aaxnet.com/editor/edit043.html>
    cbfalconer at maineline dot net



    --
    Posted via a free Usenet account from http://www.teranews.com
     
    CBFalconer, Jul 27, 2007
    #6
  7. Divya

    Chris Torek Guest

    >Divya said:
    >> I want to use indent to selectively format some code anomalies.


    In article <>
    Richard Heathfield <> wrote:
    >Why are you asking in comp.lang.c? Perhaps comp.unix.programmer or
    >comp.os.linux.development.apps would be a better starting point.


    As someone else noted, those are quite possibly the wrong groups for
    the redirection.

    To the original poster, though, be careful about where you ask and
    the replies you get: there are multiple, differing versions of
    "indent", which behave differently. Answers you get here in
    comp.lang.c may not be correct for whichever version of indent you
    have. Several of the GNU versions (you probably have one of those)
    have quite a few options for controlling the results -- you could
    spend weeks fiddling with them all. :)
    --
    In-Real-Life: Chris Torek, Wind River Systems
    Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
    email: forget about it http://web.torek.net/torek/index.html
    Reading email is like searching for food in the garbage, thanks to spammers.
     
    Chris Torek, Jul 27, 2007
    #7
  8. Divya

    CBFalconer Guest

    Re: how to suppress "indent" from performing functions not specified inthe options?

    Chris Torek wrote:
    > Richard Heathfield <> wrote:
    >> Divya said:
    >>
    >>> I want to use indent to selectively format some code anomalies.

    >
    >> Why are you asking in comp.lang.c? Perhaps comp.unix.programmer or
    >> comp.os.linux.development.apps would be a better starting point.

    >
    > As someone else noted, those are quite possibly the wrong groups for
    > the redirection.
    >
    > To the original poster, though, be careful about where you ask and
    > the replies you get: there are multiple, differing versions of
    > "indent", which behave differently. Answers you get here in
    > comp.lang.c may not be correct for whichever version of indent you
    > have. Several of the GNU versions (you probably have one of those)
    > have quite a few options for controlling the results -- you could
    > spend weeks fiddling with them all. :)


    Actually, IMO, if you read the manual it is quite straight
    forward. I setup and use the following (one line) several years
    ago:

    -kr -l66 -i3 -bad -di16 -lc66 -nce -ncs -cbi0 -bbo -pmt -psl -ts1
    -cdw -ppi 3

    That line lives in indent.pro. My only real objection is the
    handling of the procedure names.

    --
    <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
    <http://www.securityfocus.com/columnists/423>
    <http://www.aaxnet.com/editor/edit043.html>
    cbfalconer at maineline dot net



    --
    Posted via a free Usenet account from http://www.teranews.com
     
    CBFalconer, Jul 28, 2007
    #8
  9. Divya

    Jack Klein Guest

    On Fri, 27 Jul 2007 03:37:20 -0700, Divya <>
    wrote in comp.lang.c:

    > I want to use indent to selectively format some code anomalies. For
    > example, braces after if, etc. But, when I use the indent progam with -
    > bl option, it does other things as well and changes the whole source
    > code to some coding style. It's probably the GNU coding style. But, I
    > want only the "braces after if" to be fixed and rest of the source
    > code to be untouched. How can this be done?


    Sorry, but the use of third party programs like pretty printers and
    formatters is not defined by the C standard, not part of the language,
    and completely off-topic here.

    Try a gcc support group, one of their mailing lists.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
     
    Jack Klein, Jul 28, 2007
    #9
  10. Divya

    Joe Wright Guest

    Re: how to suppress "indent" from performing functions not specifiedin the options?

    Divya wrote:
    > I want to use indent to selectively format some code anomalies. For
    > example, braces after if, etc. But, when I use the indent progam with -
    > bl option, it does other things as well and changes the whole source
    > code to some coding style. It's probably the GNU coding style. But, I
    > want only the "braces after if" to be fixed and rest of the source
    > code to be untouched. How can this be done?
    >

    GNU indent is available in source code. I recommend you download it and
    compile indent for your own system.

    Then examine the source code. See how it works. Tweak it here and there
    until it does what you want.

    --
    Joe Wright
    "Everything should be made as simple as possible, but not simpler."
    --- Albert Einstein ---
     
    Joe Wright, Jul 28, 2007
    #10
  11. Jack Klein <> wrote:

    > Try a gcc support group, one of their mailing lists.


    yawn - a regular poster operating on the assumption that giving misleading
    advice is preferable to letting the rest of the mob cast stones.

    --
    Thomas E. Dickey
    http://invisible-island.net
    ftp://invisible-island.net
     
    Thomas Dickey, Jul 29, 2007
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gene Ellis

    >> Options for performing XSLT

    Gene Ellis, Apr 21, 2004, in forum: XML
    Replies:
    0
    Views:
    586
    Gene Ellis
    Apr 21, 2004
  2. IamIan
    Replies:
    2
    Views:
    267
    Marc 'BlackJack' Rintsch
    Feb 9, 2007
  3. dt
    Replies:
    4
    Views:
    528
    CBFalconer
    Dec 31, 2006
  4. Jonathan M. Rose

    Options for GNU Indent

    Jonathan M. Rose, Jul 13, 2007, in forum: C Programming
    Replies:
    2
    Views:
    765
    Jonathan M. Rose
    Jul 17, 2007
  5. Nathan Sokalski

    Firefox not performing client-side validation

    Nathan Sokalski, Mar 24, 2010, in forum: ASP .Net
    Replies:
    12
    Views:
    1,454
    Scream For Me
    Jun 7, 2010
Loading...

Share This Page