http://invisible-island.net/
Copyright © 2010-2019,2022 by Thomas E. Dickey


Synopsis

This is an improved version of GNU indent.

History

First, a recap of indent:

BSD

Indent appeared in 4.1BSD, with files dated October 21, 1982. Its sources contain a readme file:

This is the C indenter, it originally came from the University of Illinois
via some distribution tape for PDP-11 Unix.  It has subsequently been
hacked upon by James Gosling @ CMU.  It isn't very pretty, and really needs
to be completely redone, but it is probably the nicest C pretty printer
around.

The sources have copyright notices for University of Illinois, 1976. Most files also have this comment:

November 1976   D A Willcox of CAC      Initial coding

Some history has been lost, but this is where we begin.

4.2BSD (1983) dropped the SCCS keywords, e.g., “@(#)indent_codes.h”, leaving just the version and date.

4.3BSD (1985) made a number of changes:

4.4BSD (1993) made similar changes:

GNU indent started with this source, according to its copyright notices. The oldest generally available release of GNU indent is 1.9.1, in 1994 (one historical site has 1.8, from 1993). According to the ChangeLog in that release, development began in 1991, but also a “OChangeLog” which one might overlook, pushing the beginning date back to 1989. In neither does it mention that this was a derived work. The following release (5 years later) added an AUTHORS file, and renamed “OChangeLog” to ChangeLog-1990.

GNU

My involvement

I started working on this in mid-1999. My original intent was to provide changes to its maintainer, who would then own them. As noted elsewhere, maintainers may be less responsive to changes than the primary developers. In this case, the original developer had moved on, leaving a succession of maintainers.

Here are the patches which I made:

19990609 A patch to indent 2.0, which does the following:
20010112 Fixes a buffer overflow when reading a comment with very long line (e.g., 2k).
20020428 Lots of fixes, making this usable for the special syntax used for conditional macros in xterm.

I do not use post-2.0 indent because it introduces more bugs than it fixes. Each time I notice a newer 2.x version, I test it, comparing to the 2.0 case, and note that most of the differences are making the output formatted other than as requested. From this, I conclude:

The former I could excuse in a utility being modified for private use, as I did for bcpp. Before deciding to work on bcpp, I studied it, and indent, and chose the former, since the latter is badly-structured, and would have taken several months to remedy.

Current package (cindent)

However, the patched indent fills a need in my development work. Besides patching it, I added scripts to extend it over several years. I use these scripts in most of the C-language programs on my website.

See the changelog for details:

documentation

Download

The resulting package (usually installed as cindent is here: