indent (Unix)

{{lowercase|title=indent}}

{{refimprove|date=April 2014}}

{{ infobox software

| name = indent

| logo =

| caption =

| author = David Willcox

| released = {{Start date and age|1976|11}}

| programming_language = C

| developer = David Ingamells, Carlo Wood, Joseph Arceneaux, Jim Kingdon, John Bridges

| latest release version = {{wikidata|property|reference|P348}}

| latest release date = {{start date and age|{{wikidata|qualifier|P348|P577}}}}

| latest_preview_version =

| latest_preview_date =

| operating_system = Cross-platform

| genre = source-code-reformat tool

| license = GNU: GPL-3.0-or-later{{cite web | author = GNU Savannah | title = GNU indent | url = https://savannah.gnu.org/projects/indent | quote = License: GNU General Public License v3 or later | access-date = 2023-10-30}}

| website = GNU: {{URL|gnu.org/software/indent/}}

}}

indent is a Unix utility that reformats C and C++ code in a user-defined indentation style and coding style. Support for C++ code is minimal.{{Cite web|url=http://www.gnu.org/software/indent/manual/indent.html#SEC15|title=indent: Indent and Format C Program Source|website=www.gnu.org|access-date=2019-08-16}}

The original version of indent was written by David Willcox at the University of Illinois in November 1976. It was incorporated into 4.1BSD in October 1982.{{cite web

|url=https://invisible-island.net/cindent/cindent.html

|title=CINDENT - C-language formatter

|last=Dickey

|first=Thomas

|date=2017

|website=Invisible Island

|access-date=2019-04-22}} GNU indent was first written by Jim Kingdon in 1989. The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.{{Cite web|url=http://unxutils.sourceforge.net/|title=Native Win32 ports of some GNU utilities|website=unxutils.sourceforge.net}}

Examples of usage

The following command

$ indent -st -bap -bli0 -i4 -l79 -ncs -npcs -npsl -fca -lc79 -fc1 -ts4 some_file.c

indents some_file.c in a style resembling BSD/Allman style and writes the result to the standard output.

GNU indent

GNU indent is the GNU Project's version of indent. A different indentation style, the GNU style, is used by default.[https://www.gnu.org/software/indent/manual/indent.pdf GNU Indent Manual]

References

{{reflist}}