HTML automatically generated with rman
Table of Contents


cproto - generate C function prototypes from C source code


cproto [ option ... ] [ file ... ]


Cproto reads C source code files and outputs function prototypes for external functions defined in the source to standard output. The function definitions may be in the old style or ANSI style. Optionally, cproto also outputs declarations for any external variables defined in the file. If no file argument is given, cproto takes its input from the standard input.


Output the keyword extern in front of each declaration having global scope.
Set the style of function prototype where n is a number from 0 to 4. For example, consider the function definition

main (argc, argv)
int argc;
char *argv[];

If the value is 0, then no prototypes are generated. When set to 1, the output is:

int main(/*int argc, char *argv[]*/);

For a value of 2, the output has the form:

int main(int /*argc*/, char */*argv*/[]);

The default value is 3. It produces the full function prototype:

int main(int argc, char *argv[]);

A value of 4 produces prototypes guarded by a macro:

int main P_((int argc, char *argv[]));

Set the name of the macro used to guard prototypes when option -f4 is selected. By default it is "P_".
Omit the definition of the prototype macro named by the -m option.
Disable promotion of formal parameters in function prototypes. By default, parameters of type char or short in traditional style function definitions are promoted to type int in the function prototype. Parameters of type float get promoted to double as well.
Also output static declarations.
Also output declarations for variables defined in the file.
Set the format used to output each prototype. The string is a template in the form

" int main ( a, b )"

where each space in the string may be replaced with whitespace characters. For example, the option

-F"int main(\n\ta,\n\tb\n\t)"

will produce prototypes in the format

int main(
        int argc,
        char *argv[]

This option is passed through to the preprocessor and is used to define symbols for use with conditionals such as #ifdef.
This option is passed through to the preprocessor and is used to remove any definitions of this symbol.
This option is passed through to the preprocessor and is used to specify a directory to search for files that are referenced with #include.
Print version information.


Chin Huang cthuang@contact.uucp chin.huang@canrem.uucp


When cproto finds an error, it usually outputs the not very descriptive message "syntax error".
Options that take string arguments only interpret the following
character escape sequences:

\n    newline
\t    tab

See Also

cc(1) , cpp(1)


NEMO/usr/lib/cproto - source code location within NEMO

Table of Contents