Beautify code
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Beautify code




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Beautify code  
Anurag


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-18-07 06:23 PM

Hi I wiould like to beautify code, but not create new file as needed
in indent and cb. There are any other way to do it?






[ Post a follow-up to this message ]



    Re: Beautify code  
Pascal Bourguignon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-19-07 12:17 AM

Anurag <anurag.cs@gmail.com> writes:

> Hi I wiould like to beautify code, but not create new file as needed
> in indent and cb. There are any other way to do it?

You could use an editor like emacs.

But the "create a new file" part can easily be aleviated:

cp source.c source.c~ && indent < source.c~ | cb > source.c

Et hop!  No new file!

--
__Pascal Bourguignon__                     http://www.informatimago.com/

NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.





[ Post a follow-up to this message ]



    Re: Beautify code  
Bruintje Beer


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-19-07 06:20 AM


"Anurag" <anurag.cs@gmail.com> schreef in bericht
news:1179511873.505920.69630@q23g2000hsg.googlegroups.com...
> Hi I wiould like to beautify code, but not create new file as needed
> in indent and cb. There are any other way to do it?
>

Use astyle

John







[ Post a follow-up to this message ]



    Re: Beautify code  
Bin Chen


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-20-07 06:21 AM

On May 19, 3:10 am, Pascal Bourguignon <p...@informatimago.com> wrote:
> Anurag <anurag...@gmail.com> writes: 
>
> You could use an editor like emacs.
>
> But the "create a new file" part can easily be aleviated:
>
>    cp source.c source.c~ && indent < source.c~ | cb > source.c

where i can find the cb tool?






[ Post a follow-up to this message ]



    Re: Beautify code  
guru


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-20-07 06:23 PM

On May 19, 12:10 am, Pascal Bourguignon <p...@informatimago.com>
wrote:
> Anurag <anurag...@gmail.com> writes: 
>
> You could use an editor like emacs.
>
> But the "create a new file" part can easily be aleviated:
>
>    cp source.c source.c~ && indent < source.c~ | cb > source.c

I thing sometimes doesn't work. Better to use "xargs" when using
pipes.

>
> Et hop!  No new file!
>
> --
> __Pascal Bourguignon__                    http://www.informatimago.com/
>
> NOTE: The most fundamental particles in this product are held
> together by a "gluing" force about which little is currently known
> and whose adhesive power can therefore not be permanently
> guaranteed.







[ Post a follow-up to this message ]



    Re: Beautify code  
Giorgos Keramidas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-21-07 12:21 AM

On 20 May 2007 11:06:32 -0700, guru <guru.jois@gmail.com> wrote:
>On May 19, 12:10 am,
>Pascal Bourguignon <p...@informatimago.com> wrote: 
>
> I thing sometimes doesn't work. Better to use "xargs" when using
> pipes.

Not really; it works fine.

The xargs utility solves a different problem, when there is a chance for
the full length of the command-line to exceed system limits.  In this
case, no part of the command-line is generated by some backquote
expansion or similar constructs, so xargs is not necessary.






[ Post a follow-up to this message ]



    Re: Beautify code  
vasudevram


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-21-07 06:19 PM

On May 21, 12:28 am, Giorgos Keramidas <keram...@ceid.upatras.gr>
wrote:
> On 20 May 2007 11:06:32 -0700, guru <guru.j...@gmail.com> wrote:
> 
> 
> 
> 
> 
>
> Not really; it works fine.
>
> The xargs utility solves a different problem, when there is a chance for
> the full length of the command-line to exceed system limits.  In this
> case, no part of the command-line is generated by some backquote
> expansion or similar constructs, so xargs is not necessary.

Yes; also, apart from backquote expansion, a possibly more common way
in which the command line can become too long, is if filename wildcard
characters (glob chars like * are used, and there are many files
matching). That doesn't apply to the example given above, of course,
but mentioning it since the OP might try doing the command with
wildcards. If using wildcards, unless you're sure exactly what the
wildcards mean, and how many files are going to match, and how long
the command line is going to become as a result, a useful trick is to
precede the entire command with "echo "; this doesn't do anything
permanent or damaging (just prints the expanded command to the screen,
but by this you get to see the expanded command without running it. Of
course if you have pipes etc. as in the example, you may have to tweak
what I've said for the echo trick to work.

Vasudev Ram
Dancing Bison Enterprises
http://www.dancingbison.com







[ Post a follow-up to this message ]



    Re: Beautify code  
Thomas Dickey


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-22-07 12:18 PM

Bin Chen <binary.chen@gmail.com> wrote:

> where i can find the cb tool?

'cb' was distributed with some of the AT&T Unix's - I haven't seen a copy
for a long time.  It wasn't quite as good as 'indent' then (though
making changes to 'indent' is harder ;-)

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:47 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register