ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have this on running debate about how a C source file SHOULD BE formatted. So I use indent to format it to my specs. Right now I can't get it to the way I want it. For example, this is the output
from indent:
int
Quit (
)
{
gettimeofday ( &Timer, '\0' );
localtime_r ( &Timer.tv_sec, &Time );
fprintf ( stderr, "%.2d:%.2d:%.2d.%.4d ", ( int )Time.tm_hour,
( int )Time.tm_min, ( int )Time.tm_sec,
( int )Timer.tv_usec / 100 );;
printf ( "\x1B[1;34;40m" "Exiting" "\x1B[0;0;0m" "\x1B[K\n" );
exit ( 0 );
}
You should put code inside [ code ]...[ /code ] blocks to preserve the indentation when posting code segments. The .profile.pro options you posted result in:
Code:
indent ind1 -st
int
Quit (
)
{
gettimeofday ( &Timer, '\0' );
localtime_r ( &Timer.tv_sec, &Time );
fprintf ( stderr, "%.2d:%.2d:%.2d.%.4d ", ( int )Time.tm_hour,
( int )Time.tm_min, ( int )Time.tm_sec,
( int )Timer.tv_usec / 100 );;
printf ( "\x1B[1;34;40m" "Exiting" "\x1B[0;0;0m" "\x1B[K\n" );
exit ( 0 );
}
There is a -br and -bl option handling braces. I can't imagine why anyone would want the closing brace on the last line of code. Unless you have a very small block contained on one line of code.
You should put code inside [ code ]...[ /code ] blocks to preserve the indentation when posting code segments. The .profile.pro options you posted result in:
Code:
indent ind1 -st
int
Quit (
)
{
gettimeofday ( &Timer, '\0' );
localtime_r ( &Timer.tv_sec, &Time );
fprintf ( stderr, "%.2d:%.2d:%.2d.%.4d ", ( int )Time.tm_hour,
( int )Time.tm_min, ( int )Time.tm_sec,
( int )Timer.tv_usec / 100 );;
printf ( "\x1B[1;34;40m" "Exiting" "\x1B[0;0;0m" "\x1B[K\n" );
exit ( 0 );
}
There is a -br and -bl option handling braces. I can't imagine why anyone would want the closing brace on the last line of code. Unless you have a very small block contained on one line of code.
Thanks for the comments. I will use the code keyword from now on.
The -br and -bl does what I want for IFs, that is good. But I do want what you can't image. I am dyslexic and do not see thing the same as you do.
The lone brackets confuse my eyes, they just cause visual interference.
Using your example, here is what I want:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.