Extracting C function prototypes

posted in: C, tricks | 0

Often, when I write some C code, I write header file at last. One task that is really long and boring is to copy function prototype into header. To help me with this task, I wrote a command line to extract the function prototype and copy them directly in the header file.

Here is the command:

You can forward the output to a file using a Unix redirection like this:

Don’t forget to add the usual  #ifndef in order to protect from double inclusion.



Leave a Reply