LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

indent

reformats C source code according to specified style guidelines

TLDR

Format C source file
$ indent [source.c]
copy
Format to specific style
$ indent -kr [source.c]
copy
GNU style formatting
$ indent -gnu [source.c]
copy
BSD style formatting
$ indent -orig [source.c]
copy
Output to different file
$ indent [input.c] -o [output.c]
copy
Set tab width to 4 spaces
$ indent -ts4 [source.c]
copy
Set indentation to 4 spaces per level
$ indent -i4 [source.c]
copy

SYNOPSIS

indent [options] file [output]

DESCRIPTION

indent reformats C source code according to specified style guidelines. It handles indentation, brace placement, spacing, and line breaking.The tool supports predefined styles (K&R, GNU, BSD) and extensive customization. It can modify files in place or write to new files.

PARAMETERS

-kr

Kernighan & Ritchie style.
-gnu
GNU coding style.
-orig
Original BSD style.
-linux
Linux kernel style.
-ts N
Set tab size.
-i N
Set indentation level.
-l N
Maximum line length.
-o FILE
Output file.
-npro
Do not read .indent.pro profile files.
-bad
Force blank line after declarations.
-bap
Force blank line after procedure bodies.
-nbc
Do not force newlines after commas in declarations.
--help
Display help information.

INSTALL

sudo apt install indent
copy
sudo dnf install indent
copy
sudo pacman -S indent
copy
sudo apk add indent
copy
sudo zypper install indent
copy
nix profile install nixpkgs#indent
copy

CAVEATS

C-specific; does not handle C++ or other languages well. May alter semantics when processing complex macros or preprocessor directives. Modifies files in-place by default; use -o to write to a separate file. Configuration can be stored in .indent.pro files loaded automatically from the current directory or home directory.

HISTORY

indent originated in BSD Unix. The GNU version was developed as part of the GNU project with extended options.

SEE ALSO

clang-format(1), astyle(1), cb(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid