xref: /minix/minix/commands/ifdef/ifdef.1 (revision 9f988b79)
IFDEF 1
NAME
ifdef - remove #ifdefs from a file
SYNOPSIS
ifdef [-t] [-dsymbol] [-Dsymbol] [-Usymbol] [-Isymbol] [file]

\\\$1\ \\$2 ..

20 \\\$1\ # \\$2 ..

OPTIONS

5 -D # Define symbol permanently

5 -I # Ignore symbol

5 -U # Undefine symbol permanently

5 -d # Define symbol. It may be #undef'ed later

5 -t # Produce a table of the symbols on stdout

EXAMPLES

20 ifdef -DUNIX file.c >newfile.c # Define UNIX

20 ifdef -D_MINIX -UDOS <x.c >y.c # Define _MINIX, undefine DOS

DESCRIPTION

Ifdef allows conditional code [ #ifdef ... #endif ] to be selectively removed from C files, but at the same time leaving all other C preprocessor commands intact such as #define, #include etc. Input to ifdef is either the file named as the last argument, or stdin if no file is named. Output goes to stdout.

Symbols may be defined with the -d or -D flags just like cpp, except that the latter option ignores subsequent #undefs. It is not permitted to give values to symbols. Similarly, -U undefines a symbol and ignores subsequent #definess. Symbols defined with -I are ignored; any #ifdef using an ignored symbol will be left intact.