unifdef(1) Unsupported unifdef(1)Nameunifdef - removes ifdef'ed lines
Syntaxunifdef [ -c -Dsym -idsym -iusym -l -t -Usym ] ... [ file ]
Description
The command is useful for removing ifdef'ed lines from a file while
otherwise leaving the file alone. The command is like a stripped-down
C preprocessor: it is smart enough to deal with the nested ifdefs, com‐
ments, single and double quotes of C syntax so that it can do its job,
but it doesn't do any including or interpretation of macros. Neither
does it strip out comments, though it recognizes and ignores them.
Ifdefs involving symbols you don't specify are untouched and copied out
along with their associated ifdef, else, and endif lines. The ifdef,
ifndef, else, and endif lines associated with the symbol, sym, will
also be removed. If an ifdef X occurs nested inside another ifdef X,
then the inside ifdef is treated as if it were an unrecognized symbol.
If the same symbol appears in more than one argument, only the first
occurrence is significant.
If you use ifdefs to delimit non-C lines, such as comments or code
which is under construction, then you must tell unifdef which symbols
are used for that purpose so that it won't try to parse for quotes and
comments in those ifdef'ed lines.
The command copies its output to stdout and will take its input from
stdin if no file argument is given.
Options-c Causes the operation of to be complemented. The lines that
would have been removed or blanked are retained and vice
versa.
-idsym Specifies that you want the lines inside certain ifdefs to be
ignored, but copied out.
-iusym Specifies that you want the lines inside certain ifdefs to be
ignored, but copied out.
-l Causes to replace removed lines with blank lines instead of
deleting them.
-t Makes refrain from attempting to recognize comments and sin‐
gle and double quotes. This option is for use on plain text
(not C code).
-Dsym Specifies which symbols you want defined and the lines inside
those ifdefs will be copied to the output.
-Usym Specifies which symbols you want undefined and the lines
inside those ifdefs will be removed.
Restrictions
Does not know how to deal with cpp constructs such as
#if defined(X) || defined(Y)Diagnostics
Premature EOF, inappropriate else or endif.
Exit status is 0 if output is exact copy of input, 1 if not, 2 if trou‐
ble.
See Alsodiff(1)unifdef(1)