By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,725 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,725 IT Pros & Developers. It's quick & easy.

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

P: n/a
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?

Jul 27 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
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
Jul 27 '07 #2

P: n/a
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.
Jul 27 '07 #3

P: n/a
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
Jul 27 '07 #4

P: n/a
Divya <di************@gmail.comwrote:
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
Jul 27 '07 #5

P: n/a
>Divya said:
>I want to use indent to selectively format some code anomalies.
In article <3v******************************@bt.com>
Richard Heathfield <rj*@see.sig.invalidwrote:
>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 (4039.22'N, 11150.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.
Jul 27 '07 #6

P: n/a
On Fri, 27 Jul 2007 03:37:20 -0700, Divya <di************@gmail.com>
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
Jul 28 '07 #7

P: n/a
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 ---
Jul 28 '07 #8

P: n/a
Jack Klein <ja*******@spamcop.netwrote:
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
Jul 29 '07 #9

P: n/a
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

Aug 1 '07 #10

P: n/a
Chris Torek wrote:
Richard Heathfield <rj*@see.sig.invalidwrote:
>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

Aug 1 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.