GNU indent is a utility which reformats source code according to a maze of command-line options. The options are insufficiently expressive; for example, the -prs option causes all parentheses to be separated with a space from whatever is between them. Without -prs, parens are never padded. This is infuriating, because padding within parens is useful with function arguments but annoying within typecasts. Code should look like this: (char *)calloc( n, sizeof( foo ) );. This is clearly the only correct way to format C code, and Jesus agrees with me; but GNU gives you a choice between the following two inadequate substitutes:
    ( char * ) calloc( n, sizeof( foo ) );
. . . or . . .
    (char *) calloc(n, sizeof(foo));
Not unreasonably, the one formatting style which GNU indent handles perfectly is the GNU indenting style.

Even with flaws, GNU indent is a lot nicer than reformatting code by hand or with sed. If your text editor is willing to run arbitrary utilities on the text in the buffer, GNU indent will make your cube an abode of bliss. That goes double if you need to hack horribly malformatted GNU code in indent itself, so as to make indent do exactly what you want so you can use it to reformat horribly malformatted GNU code.

Log in or register to write something here or to contact authors.