cflat − filter C source for easier searching |
cflat [ OPTIONS ] [ FILE... ] |
cflat reads the named source files (or standard input if no files are named, or the file name - is given) and prints (by default) three TAB-separated columns to stdout: The first column shows filename and line number separated by a colon. The second column shows the scope of the source line (usually the function definition). By default only a single level of scope is printed. The third column contains the original source lines with TABs expanded. (If a delimiter other than TAB is specified on the command line, then TABs are left unchanged.) cflat recognizes C and C++ comments, string literals and character literals. Note that cflat uses simple heuristics to generate the scope column. If the input does any clever things with C macros or is otherwise unusual the output in the scope column may not be what you expect. This does not affect the other columns. |
−c |
Strip comments from the source code. |
−d DELIM, −−delimiter=DELIM |
Use the character DELIM for separating columns. If DELIM is different from TAB, then TABs in the source are left unchanged. |
−F, −−no-filename |
Omit the filename in the first column. If −N is also present the first column is not printed. |
−H |
Do not print the first (filename and line number) column. |
||
−−help |
Print usage summary and exit. |
−l NUM, −−levels=NUM |
Show NUM levels of scope in the second column. If NUM is negative the number of levels is considered unlimited. The default is 1. |
−N, −−no-line-number |
Omit the line number in the first column. If −F is also present the first column is not printed. |
−−only CLASSES |
Strip all but the given classes of text from the source code. CLASSES is a string which may contain any of the characters described in the section TEXT CLASSES. |
−P, −−no-scope |
Do not print the second (scope) column. |
−s |
Strip string literals from the source code. |
−−strip CLASSES |
Strip the given classes of text from the source code. CLASSES is a string which may contain any of the characters described in the section TEXT CLASSES. |
−t |
Strip program text from the source code. Program text is anything except comments and string literals. |
||
−T |
This option is equivalent to −zHP. It has the effect of limiting the output to the third column, without expanding tabs. |
−V, −−version |
Print cflat version and exit. |
−z |
Use the ASCII NUL character as delimiter. TABs in the source are left unchanged. |
−−with-args |
Include function arguments in the scope column. |
Strings specifying text classes may contain the following characters: |
c |
selects comments (including their delimiters) |
||
s |
selects string literals (including their delimiters) |
||
t |
selects other program text (non-comment and non-string-literal) |
Please report any bugs you find to the author (see below). cflat exits with an error message if it finds an unbalanced closing ´}´. Maybe a heuristic algorithm should be implemented to deal with incomplete source code. |
Edwin Steiner <edwin.steiner@gmx.net> Please include the word ’cflat’ in the subject line when contacting me. |