tdindent(1)
| TDINDENT(1) | General Commands Manual | TDINDENT(1) |
NAME
tdindent - utility scripts for cindent.
SYNOPSIS
tdindent [options]
DESCRIPTION
This is a wrapper for the cindent program, which adds options. Unrecognized options are passed to cindent.
Before using cindent, the wrapper saves the file and checks after if there were any changes. If no change was made, the wrapper restores the original file.
Options:
- -h
- display a usage message for tdindent.
- -n
- perform indent and show difference without saving the result. This is useful for previewing cindent's splitting of lines.
- --profile file
- get settings, use those to override .indent.pro. The script looks in the current directory, the user's home directory, or in a configuration-specific location.
- -s
- convert tabs to spaces in the updated file. The script relies on the settings from the --profile option to get the tab-size for expansion.
- -D
- after pre-filtering, show the changes that this script passes to the cindent program. This and the -N option are useful for verifying that the macros which are filtered are handled correctly.
- -N
- do not execute the cindent program. Only perform the pre-filtering and post-filtering stages.
FILE TYPES
The wrapper script checks each file's suffix. It accepts these:
- .c .h
- These are the standard C suffixes.
- .cc .cpp .hh
- These are accepted as "close enough" to C.
- .l .y
- The wrapper adds to -ly option, telling cindent to process lex/yacc files.
It ignores other file-suffixes, making it possible to run the cindent program on all files in a directory.
FILTERING
The cindent program by itself cannot handle certain commonly-used macros, e.g., from ncurses and xterm. The wrapper script temporarily changes references to these to a form that cindent can handle:
EMPTY_MODULE GCC_NORETURN GCC_PRINTFLIKE GCC_SCANFLIKE GCC_UNUSED MARK_END_OF_PROLOG MODULEID MODULE_ID NCURSES_EXPORT_VAR YY_BREAK YY_RULE_SETUP
OTHER SCRIPTS
There are several profiles and corresponding wrapper scripts:
- bsd-indent
- This uses the "original" (Sun) indent settings.
- cdk-indent
- These are the settings used for the CDK (curses development kit).
- flx-indent
- These are the settings used for reflex's skeleton.
- gnu-indent
- This uses the GNU indent settings.
- jpf-indent
- These are the indent settings used by Juergen Pfeifer for ncurses.
- lnx-indent
- These are the settings used for the lynx web browser.
- ncu-indent
- These are the indent settings used for ncurses, as well as other programs such as xterm, vile, diffstat.
- tin-indent
- These are the settings used for the tin newsreader.
- vtt-indent
- These are the settings used for vttest.
- yak-indent
- These are the settings used for byacc (Berkeley Yacc).
- xxx-indent
- These settings are useful for formatting X11, Xt and Xaw source files.
There are a few scripts used for comparison with GNU indent:
- twm-indent
- Uses xorg-indent, adding typedefs from twm headers.
- xorg-indent
- Uses GNU indent with the profile from xxx-indent.
- xxx-compare
- Compares the results from xxx-indent and xorg-indent.
ENVIRONMENT
- INDENT_PROG
- Set the name of the indent program. The default value is configuration-specific, but uses an environment variable to allow temporary customization.
- INDENT_DATA
- Set the location where profile files are found. This is configuration-specific.
NOTES
The line numbering presented by GNU indent is generally incorrect. Use cindent, at
While GNU indent does not support the --profile option, tdlint checks for this and will attempt to pass the profile's contents on the command-line, making it possible to compare formatting results.
SEE ALSO
cindent(1).
