LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-19-2005, 08:07 AM   #1
phoenix7
Member
 
Registered: Aug 2004
Distribution: Mandrake 10.2(Mandriva), SuSE 9.3, Slackware 9.1, Xandros 3.1, Knoppix 3.9, FreeBSD 5.3, RedHat9
Posts: 122

Rep: Reputation: 15
indent


Hi
did you know any gui for gnu indent utility? I want to change -kr style in order that for example
Code:
int main () {
    return 0;
}
instead of
Code:
int main ()
{
    return 0;
}
and
Code:
if (condition) {
    statements;
}
instead of
Code:
if (condition) {
statements;
}
Thanks,
-- Mohammad
 
Old 08-19-2005, 08:30 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
I don't know of a gui for indent.. but all the options are listed in the man page (man indent). It also tells you what all the options it uses when you apply the -kr switch are and such in the COMMON STYLES section of the man page.

Last edited by jtshaw; 08-19-2005 at 08:32 AM.
 
Old 08-20-2005, 08:04 AM   #3
phoenix7
Member
 
Registered: Aug 2004
Distribution: Mandrake 10.2(Mandriva), SuSE 9.3, Slackware 9.1, Xandros 3.1, Knoppix 3.9, FreeBSD 5.3, RedHat9
Posts: 122

Original Poster
Rep: Reputation: 15
I could not find what I want?
 
Old 08-25-2005, 11:03 AM   #4
phoenix7
Member
 
Registered: Aug 2004
Distribution: Mandrake 10.2(Mandriva), SuSE 9.3, Slackware 9.1, Xandros 3.1, Knoppix 3.9, FreeBSD 5.3, RedHat9
Posts: 122

Original Poster
Rep: Reputation: 15
is there a better doc for indent (including picture & ...) ?!!
 
Old 08-25-2005, 11:14 AM   #5
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Since it is a text based program I don't think it is likely you'll find any documenation with pictures...

Indent options:
Code:
-bad, --blank-lines-after-declarations
           Force blank lines after the declarations.
           See  BLANK LINES.

       -bap, --blank-lines-after-procedures
           Force blank lines after procedure bodies.
           See  BLANK LINES.

       -bbb, --blank-lines-before-block-comments
           Force blank lines before block comments.
           See  BLANK LINES.

       -bbo, --break-before-boolean-operator
           Prefer to break long lines before boolean operators.
           See  BREAKING LONG LINES.

       -bc, --blank-lines-after-commas
           Force newline after comma in declaration.
           See  DECLARATIONS.

       -bl, --braces-after-if-line
           Put braces on line after if, etc.
           See  STATEMENTS.

       -blin, --brace-indentn
           Indent braces n spaces.
           See  STATEMENTS.

       -bls, --braces-after-struct-decl-line
           Put braces on the line after struct declaration lines.
           See  DECLARATIONS.

       -br, --braces-on-if-line
           Put braces on line with if, etc.
           See  STATEMENTS.

       -brs, --braces-on-struct-decl-line
           Put braces on struct declaration line.
           See  DECLARATIONS.

       -bs, --Bill-Shannon, --blank-before-sizeof
           Put a space between sizeof and its argument.
           See  STATEMENTS.

       -cn, --comment-indentationn
           Put comments to the right of code in column n.
           See  COMMENTS.

       -cbin, --case-brace-indentationn
           Indent braces after a case label N spaces.
           See  STATEMENTS.

       -cdn, --declaration-comment-columnn
           Put comments to the right of the declarations in column n.
           See  COMMENTS.

       -cdb, --comment-delimiters-on-blank-lines
           Put comment delimiters on blank lines.
           See  COMMENTS.

       -cdw, --cuddle-do-while
           Cuddle while of do {} while; and preceeding `}'.
           See  COMMENTS.

       -ce, --cuddle-else
           Cuddle else and preceeding `}'.
           See  COMMENTS.

       -cin, --continuation-indentationn
           Continuation indent of n spaces.

       -clin, --case-indentationn
           Case label indent of n spaces.
           See  STATEMENTS.

       -cpn, --else-endif-columnn
           Put comments to the right of #else and #endif statements in column n.
           See  COMMENTS.

       -cs, --space-after-cast
           Put a space after a cast operator.
           See  STATEMENTS.

       -dn, --line-comments-indentationn
           Set indentation of comments not to the right of code to n spaces.
           See  COMMENTS.

       -bfda, --break-function-decl-args
           Break the line before all arguments in a declaration.
           See  DECLARATIONS.

       -bfde, --break-function-decl-args
           Break the line after the last argument in a declaration.
           See  DECLARATIONS.

       -din, --declaration-indentationn
           Put variables in column n.
           See  DECLARATIONS.

       -fc1, --format-first-column-comments
           Format comments in the first column.
           See  COMMENTS.

       -fca, --format-all-comments
           Do not disable all formatting of comments.
           See  COMMENTS.

       -gnu, --gnu-style
           Use GNU coding style.  This is the default.
           See  COMMON STYLES.

       -hnl, --honour-newlines
           Prefer to break long lines at the position of newlines in the input.
           See  BREAKING LONG LINES.

       -in, --indent-leveln
           Set indentation level to n spaces.
           See  INDENTATION.

       -ipn, --parameter-indentationn
           Indent parameter types in old-style function definitions by n spaces.
           See  INDENTATION.

       -kr, --k-and-r-style
           Use Kernighan & Ritchie coding style.
           See  COMMON STYLES.

       -ln, --line-lengthn
           Set maximum line length for non-comment lines to n.
           See  BREAKING LONG LINES.

       -lcn, --comment-line-lengthn
           Set maximum line length for comment formatting to n.
           See  COMMENTS.

       -lp, --continue-at-parentheses
           Line up continued lines at parentheses.
           See  INDENTATION.

       -lps, --leave-preprocessor-space
           Leave space between `#' and preprocessor directive.
           See  INDENTATION.

       -nbad, --no-blank-lines-after-declarations
           Do not force blank lines after declarations.
           See  BLANK LINES.

       -nbap, --no-blank-lines-after-procedures
           Do not force blank lines after procedure bodies.
           See  BLANK LINES.

       -nbbo, --break-after-boolean-operator
           Do not prefer to break long lines before boolean operators.
           See  BREAKING LONG LINES.

       -nbc, --no-blank-lines-after-commas
           Do not force newlines after commas in declarations.
           See  DECLARATIONS.

       -nbfda, --dont-break-function-decl-args
           Don't put each argument in a function declaration on a seperate line.
           See  DECLARATIONS.

       -ncdb, --no-comment-delimiters-on-blank-lines
           Do not put comment delimiters on blank lines.
           See  COMMENTS.

       -ncdw, --dont-cuddle-do-while
           Do not cuddle } and the while of a do {} while;.
           See  STATEMENTS.

       -nce, --dont-cuddle-else
           Do not cuddle } and else.
           See  STATEMENTS.

       -ncs, --no-space-after-casts
           Do not put a space after cast operators.
           See  STATEMENTS.

       -nfc1, --dont-format-first-column-comments
           Do not format comments in the first column as normal.
           See  COMMENTS.

       -nfca, --dont-format-comments
           Do not format any comments.
           See  COMMENTS.

       -nhnl, --ignore-newlines
           Do not prefer to break long lines at the position of newlines in the input.
           See  BREAKING LONG LINES.

       -nip, --no-parameter-indentation
           Zero width indentation for parameters.
           See  INDENTATION.

       -nlp, --dont-line-up-parentheses
           Do not line up parentheses.
           See  STATEMENTS.

       -npcs, --no-space-after-function-call-names
           Do not put space after the function in function calls.
           See  STATEMENTS.

       -nprs, --no-space-after-parentheses
           Do not put a space after every '(' and before every ')'.
           See  STATEMENTS.

       -npsl, --dont-break-procedure-type
           Put the type of a procedure on the same line as its name.
           See  DECLARATIONS.

       -nsaf, --no-space-after-for
           Do not put a space after every for.
           See  STATEMENTS.

       -nsai, --no-space-after-if
           Do not put a space after every if.
           See  STATEMENTS.

       -nsaw, --no-space-after-while
           Do not put a space after every while.
           See  STATEMENTS.

       -nsc, --dont-star-comments
           Do not put the `*' character at the left of comments.
           See  COMMENTS.

       -nsob, --leave-optional-blank-lines
           Do not swallow optional blank lines.
           See  BLANK LINES.

       -nss, --dont-space-special-semicolon
           Do not force a space before the  semicolon  after  certain  statements.   Disables
           `-ss'.
           See  STATEMENTS.

       -nut, --no-tabs
           Use spaces instead of tabs.
           See  INDENTATION.

       -nv, --no-verbosity
           Disable verbose mode.
           See  MISCELLANEOUS OPTIONS.

       -orig, --original
           Use the original Berkeley coding style.
           See  COMMON STYLES.

       -npro, --ignore-profile
           Do not read `.indent.pro' files.
           See  INVOKING INDENT.

       -pcs, --space-after-procedure-calls
           Insert a space between the name of the procedure being called and the `('.
           See  STATEMENTS.

       -pin, --paren-indentationn
           Specify  the  extra  indentation per open parentheses '(' when a statement is bro-
           ken.See  STATEMENTS.

       -pmt, --preserve-mtime
           Preserve access and modification times on output files.See  MISCELLANEOUS OPTIONS.

       -prs, --space-after-parentheses
           Put a space after every '(' and before every ')'.
           See  STATEMENTS.

       -psl, --procnames-start-lines
           Put the type of a procedure on the line before its name.
           See  DECLARATIONS.

       -saf, --space-after-for
           Put a space after each for.
           See  STATEMENTS.

       -sai, --space-after-if
           Put a space after each if.
           See  STATEMENTS.

       -saw, --space-after-while
           Put a space after each while.
           See  STATEMENTS.

       -sbin, --struct-brace-indentationn
           Indent braces of a struct, union or enum N spaces.
           See  STATEMENTS.

       -sc, --start-left-side-of-comments
           Put the `*' character at the left of comments.
           See  COMMENTS.

       -sob, --swallow-optional-blank-lines
           Swallow optional blank lines.
           See  BLANK LINES.

       -ss, --space-special-semicolon
           On one-line for and while statments, force a blank before the semicolon.
           See  STATEMENTS.

       -st, --standard-output
           Write to standard output.
           See  INVOKING INDENT.

       -T  Tell indent the name of typenames.
           See  DECLARATIONS.

       -tsn, --tab-sizen
           Set tab size to n spaces.
           See  INDENTATION.

       -ut, --use-tabs
           Use tabs. This is the default.
           See  INDENTATION.
The -kr options does the following:

Code:
            -nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0
            -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs
            -nprs -npsl -saf -sai -saw -nsc -nsob -nss
There really isn't much else that can be said. I guess if what you want isn't in those options somewhere indent doesn't offer what you want.
 
Old 08-25-2005, 11:21 AM   #6
phoenix7
Member
 
Registered: Aug 2004
Distribution: Mandrake 10.2(Mandriva), SuSE 9.3, Slackware 9.1, Xandros 3.1, Knoppix 3.9, FreeBSD 5.3, RedHat9
Posts: 122

Original Poster
Rep: Reputation: 15
Good, I saw the indentś manpage. and I canīt find options to change -kr option to open a brace in function decleration line?!!
 
Old 08-30-2005, 12:14 PM   #7
phoenix7
Member
 
Registered: Aug 2004
Distribution: Mandrake 10.2(Mandriva), SuSE 9.3, Slackware 9.1, Xandros 3.1, Knoppix 3.9, FreeBSD 5.3, RedHat9
Posts: 122

Original Poster
Rep: Reputation: 15
Isn't any idea to this is gnu indent?
Is there another tool that can indent sources?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A more sensible editor with indent Haraldsh Linux - Software 2 11-12-2004 06:49 AM
failed on modifying indent on emacs~ black Linux - Software 0 07-22-2004 11:59 PM
no indent jesus_edu Linux - Newbie 0 04-13-2004 10:45 AM
indent issues clockworks Linux - Software 0 02-09-2004 09:51 AM
indent chrismiceli Linux - General 1 05-12-2003 07:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration