unifdef - selectively remove C preprocessor conditionals


The unifdef utility selectively processes conditional C preprocessor #if and #ifdef directives. It removes from a file both the directives and the additional text that they delimit, while otherwise leaving the file alone.

It is useful for avoiding distractions when studying code that uses #ifdef heavily for portability (the original motivation was xterm's pty handling code), or as a lightweight preprocessor to strip out internal routines from a public header (the Linux kernel uses unifdef to strip out #ifdef __KERNEL__ sections from the headers it exports to userland).

Please send bug reports and patches to me. Unless you state otherwise, I will assume that any contributions are under the two-clause BSD licence. See the COPYING file for details.


unifdef was written by Tony Finch <dot@dotat.at>