Copyright © 1997-2017,2022 by Thomas E. Dickey
unproto — Compile ANSI C with traditional UNIX C compiler
I used this program to support backward compatibility (K&R C versus ANSI C) for some of the programs that I'm working on. However, I no longer use the platforms (SunOS 4 and HPUX 9) for which it was helpful.
From the README:
Mathematics and Computing Science
Eindhoven University of Technology
This is a filter that sits in between the UNIX C preprocessor and the next UNIX C compiler stage, on the fly transforming ANSI C syntax to old C syntax. Line number information is preserved so that compiler diagnostics still make sense. It runs at roughly the same speed as /lib/cpp, so it has negligible impact on compilation time.
The filter rewrites ANSI-style function headings, function pointer types and type casts, function prototypes, and combinations thereof. Unlike some other unprototypers, this one is fully recursive and does not depend on source file layout (see the example.c file).
Besides the rewriting of argument lists, the program does the following transformations: string concatenation, conversion of
\xescape sequences to their octal equivalents, translation of the
__DATE__macros, optional mapping of “
void *” to “
char *”, and optional mapping of plain “
void” to “
The unprototyper provides hooks for compilers that require special tricks for variadic functions (fortunately, many don't).
<stdarg.h>support is provided for sparc, mips, mc68k, 80x86, vax, and others.
The program has been tested with SunOS 4.1.1 (sparc), Ultrix 4.0 and 4.2 (mips), and Microport System V Release 2 (80286). It should work with almost every PCC-based UNIX C compiler.