ansi2knr - convert ANSI C to Kernighan & Ritchie C
ansi2knr [--filename filename] [input_file [output_file]]
--filename provides the file name for the #line directive in the out-
put, overriding input_file (if present).
If no input_file is supplied, input is read from stdin.
If no output_file is supplied, output goes to stdout.
There are no error messages.
ansi2knr recognizes function definitions by seeing a non-keyword iden-
tifier at the left margin, followed by a left parenthesis, with a right
parenthesis as the last character on the line, and with a left brace as
the first token on the following line (ignoring possible intervening
comments). It will recognize a multi-line header provided that no
intervening line ends with a left or right brace or a semicolon. These
algorithms ignore whitespace and comments, except that the function
name must be the first thing on the line.
ansi2knr also recognizes adjacent string literals and concatenates
The following constructs will confuse it:
- Any other construct that starts at the left margin and follows
the above syntax (such as a macro or function call).
- Some macros that tinker with the syntax of the function header.
- String literals whose concatenation requires rewriting their
contents; e.g. "ab " "07c" is concatenated to "ab 07c", which is not
The --varargs switch is obsolete, and is recognized only for backwards
compatibility. The present version of ansi2knr will always attempt to
convert a ... argument to va_alist and va_dcl.
L. Peter Deutsch <email@example.com> wrote the original ansi2knr and
continues to maintain the current version; most of the code in the cur-
rent version is his work. ansi2knr also includes contributions by
Francois Pinard <firstname.lastname@example.org>, Jim Avera <email@example.com>,
and Paul Eggert <firstname.lastname@example.org>.
8 March 2000 ANSI2KNR(1)
Man(1) output converted with