Copyright © 1996-2022,2023 by Thomas E. Dickey


cproto generates function prototypes for functions defined in the specified C source files to the standard output. The function definitions may be in K&R or ANSI C style, or in lint-library form. cproto can also convert function definitions in the specified files from the K&R style to the ANSI C style.


This program was written (and was maintained) by Chin Huang <> while at the University of Waterloo. He posted the first version to comp.sources.unix

Path: santra!kth!sunic!mcsun!uunet!snorkelwacker!usc!!!xanth!!rsalz
From: (Rich Salz)
Newsgroups: comp.sources.unix
Subject: v20i039:  Generate C function prototypes from C source
Message-ID: <>
Date: 19 Oct 89 17:21:41 GMT
Lines: 1682
Approved: rsalz@uunet.UU.NET

Submitted-by: Chin Huang <>
Posting-number: Volume 20, Issue 39
Archive-name: cproto

[  Not to be confused with Ron Guilmette's protoize, which will also
   appear here.  This takes a neat way out in that it avoids doing any
   parsing of function bodies, which I think is really clever.  As Chin
   says, you will need FLEX which is available from your nearest archive
   site and is also distributed on most GNU sites.  /r$  ]

This is program automatically generates C function prototypes and
variable declarations from C language source code.

You don't need the source to 4.2BSD lint to compile this program but
you do need flex since the lexical analyzer specified in lex.l makes use
of mutually exclusive start conditions.

Chin Huang

and several updates to comp.sources.misc:

My Involvement

I started working on cproto in June 1993, sending fixes and improvements to Chin Huang. The result appeared on comp.sources.misc a year later, after several unreleased patches:

Newsgroups: comp.sources.misc
Subject: v44i138:  cproto - generate C function prototypes, v4, Part01/06
Date: 12 Oct 1994 10:28:49 -0500
Organization: Sterling Software
Message-ID: <>
X-Md4-Signature: ca243999ab1c365ecc67df2c6e251aaf

Submitted-by: (Chin Huang)
Posting-number: Volume 44, Issue 138
Archive-name: cproto/part01
Environment: UNIX, MS-DOS, getopt, lex, yacc
Supersedes: cproto: Volume 29, Issue 61-62

This is version 4 patchlevel 0 of cproto, a program which generates
C function prototypes from C source code.  It can also convert
function definitions between old and ANSI C style.

Thanks to Thomas Dickey ( who contributed
changes to generate text files in the form of lint libraries,
added GNU configure, and ported to VAX/VMS and HP/Apollo.

I did the VAX/VMS and HP/Apollo work while at the Software Productivity Consortium, and the configure-script work after leaving. I began the lint-library work in 1993, but continued for some time.

Some time before (in 1990), I had hand-built lint-libraries for X11 on SunOS. The vendor did not distribute usable lint-libraries: the corresponding ".ln" files were zero-length, and there were no text-files to match. Moreover, X11 did not build lint-libraries that matched the sources (many functions were missing or had different parameters).

To complicate matters, I was developing with both the public X Consortium code and a distribution of Motif. The latter introduced the XtInherit design flaw which was topical about fourteen years later in the XFree86/Xorg split. None of the Motif distribution's libraries had lint libraries, but equivalents could be constructed from the header files.

Since the llib-* text files are basically the ".c" files with the function-bodies emptied, it was possible to edit them and produce correct lint library source.

But that is very time-consuming, and not something that I would do more than once. Modifying cproto was a better solution.

I added the logic to support lint libraries (my main purpose), added code to display the offending token/type in error, wrote the configure script, designed regression tests and ported to VAX/VMS.

I used the resulting lint-libraries for several years.

Current Status

There was a defunct project (a snapshot) from 2000 on SourceForge. It appeared to have been replaced in 2009 by a project for lexical analysis of lua, which is unrelated. In 2023, it again has a copy of cproto 4.6 (January 1998).

Currently I use cproto to generate lint-libraries for ncurses (for documenting interface changes). I also make occasional fixes, e.g., "4.7a".

See the changelog for details:



There are numerous references on the net to cproto. Here are a few of the more interesting ones: