cppi-1.11
cppi is a tool for automatically indenting C preprocessor
directives to reflect their nesting. See the –help output below.
Other than –help, documentation is nonexistent. I’ll set things up
to use help2man generate cppi.1 for the next release.
I’ve just learned that indent-2.2.9 has a new option, -ppi, to
do much the same thing.
There’s plenty of room for improvement. For example, currently,
the indentation width is hard-coded at one space per nesting level.
Also, one cannot yet tell cppi to ignore file-spanning directives
like these:
#ifndef FOO_H
#define FOO_H
…
#endif FOO_H
Note that the URLs for alpha.gnu.org/ below are invalid, since
I am currently unable to put files on that system.
Here are the compressed sources:
***INVALID ftp://alpha.gnu.org/gnu/cppi/cppi-1.11.tar.gz
(348KB)
***INVALID ftp://alpha.gnu.org/gnu/cppi/cppi-1.11.tar.bz2
(276KB)
http://fetish.sf.net/cppi-1.11.tar.gz
(348KB)
http://fetish.sf.net/cppi-1.11.tar.bz2
(276KB)
Here are GPG detached signatures:
ftp://alpha.gnu.org/gnu/cppi/cppi-1.11.tar.gz.asc
ftp://alpha.gnu.org/gnu/cppi/cppi-1.11.tar.bz2.asc
http://fetish.sf.net/cppi-1.11.tar.gz.asc
http://fetish.sf.net/cppi-1.11.tar.bz2.asc
Here are the MD5 and SHA1 signatures:
c2fe226e35f4e254ba8a5998d8f8444e cppi-1.11.tar.gz
c36bd6447657f7ec8268a3da5e3015bb cppi-1.11.tar.bz2
39f897ad3513da5800730dbe4740ca8872abf9cf cppi-1.11.tar.gz
5685401b6ec0e4f08812419e00b871bab9f0eb7a cppi-1.11.tar.bz2
NEWS
- Major changes in release 1.11:
revamp infrastructure to use gnulib
Here’s its –help output:
Usage: cppi [FILE]
or: cppi -c [OPTION] [FILE]…
Indent the C preprocessor directives in FILE to reflect their
nesting and ensure that there is exactly one space character
between each #if, #elif, #define directive and the following token,
and write the result to standard output. The number of spaces
between the `#’ and the following directive must correspond to the
level of nesting of that directive. With no FILE, or when FILE is
-, read standard input.
-a, –ansi | when checking, fail if text follows #else or #endif |
-c, –check | set exit code, but don’t produce any output |
-l, –list-files-only | don’t generate diagnostics about indentation; print to stdout only the names of files that are not properly indented |
-m, –max-string-length=LENGTH | fail if there is a double-quoted string longer than LENGTH; if LENGTH is 0 (the default), then there is no limit |
–help | print this help, then exit |
–version | print version information, then exit |
With the -c option, don’t write to stdout. Instead, check the
indentation of the specified files giving diagnostics for
preprocessor lines that aren’t properly indented or are otherwise
invalid.
Note that –ansi without –check does not correct the problem of
non-ANSI text following #else and #endif directives.
The exit code will be one of these:
0 all directives properly indented
1 some cpp directive(s) improperly indented
1 if text follows #else/#endif (enabled with –check –ansi)
2 #if/#endif mismatch
3 file (e.g. read/write) error
4 found a double-quoted string longer than the specified
maximum
A pragma directive may have its `#’ indented.
Report bugs to <[email protected]>.