473,378 Members | 1,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

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
10 1691
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
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
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
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
>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 (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.
Jul 27 '07 #6
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: lawrence | last post by:
When users enter urls or other long strings it can destroy the formatting of a page. A long url, posted in a comment, can cause page distortions that make the page unreadable, till the website...
0
by: Anthony Baxter | last post by:
To go along with the 2.4a3 release, here's an updated version of the decorator PEP. It describes the state of decorators as they are in 2.4a3. PEP: 318 Title: Decorators for Functions and...
1
by: Christopher P. Winter | last post by:
I'm seeing some unexpected behavior with Text-indent, as shown on this page: http://www.chris-winter.com/Digressions/HP_Kayak/My_Kayak.html I set up the following style rules for footnotes: ...
7
by: Jukka K. Korpela | last post by:
After noticing that IE 7 beta supports selectors like p+p, I started wondering how to achieve a simple rendering of paragraphs so that 1) there is no vertical spacing between paragraphs (i.e. the...
13
by: Jim | last post by:
Could somebody tell me why I need the "elif char == '\n'" in the following code? This is required in order the pick up lines with just spaces in them. Why doesn't the "else:" statement pick this...
1
by: NachosRancheros | last post by:
Ok so I just started to program with Python about a week ago and I am trying to make a program that will take the path of a file and a shortcut command and save it to a text file. Eventually I want...
2
by: snaeher | last post by:
Is there a method I can use so functions don't interpret "\n" as a carriage return in file references? EXAMPLE Function call: imagecreatefromjpeg("C:\Documents and...
7
by: sosamv | last post by:
Hi all!, I'm creating a app with PHP and MySQL, the system administrator is capable of creating profiles, on each profile we create, we add a custom access menu (a javascript tree view menu), theres...
25
by: Peng Yu | last post by:
Hi, It is possible to change the length of "\t" to a number other than 8. std::cout << "\t"; Thanks, Peng
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.