UNIFDEF(1) UNIFDEF(1) NAME unifdef - remove ifdef’ed lines SYNOPSIS unifdef [ -t -l -c -D_s_y_m -U_s_y_m -id_s_y_m -iu_s_y_m ] ... [ file ] DESCRIPTION _U_n_i_f_d_e_f is useful for removing ifdef’ed lines from a file while other‐ wise leaving the file alone. _U_n_i_f_d_e_f is like a stripped-down C prepro‐ cessor: it is smart enough to deal with the nested ifdefs, comments, 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. You specify which symbols you want defined -D_s_y_m or undefined -U_s_y_m and the lines inside those ifdefs will be copied to the output or removed as appro‐ priate. The ifdef, ifndef, else, and endif lines associated with _s_y_m will also be removed. Ifdefs involving symbols you don’t specify are untouched and copied out along with their associated ifdef, else, and endif lines. 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. The -l option causes _u_n_i_f_d_e_f to replace removed lines with blank lines instead of deleting them. If you use ifdefs to delimit non-C lines, such as comments or code which is under construction, then you must tell _u_n_i_f_d_e_f which symbols are used for that purpose so that it won’t try to parse for quotes and comments in those ifdef’ed lines. You specify that you want the lines inside certain ifdefs to be ignored but copied out with -id_s_y_m and -iu_s_y_m similar to -D_s_y_m and -U_s_y_m above. If you want to use _u_n_i_f_d_e_f for plain text (not C code), use the -t option. This makes _u_n_i_f_d_e_f refrain from attempting to recognize com‐ ments and single and double quotes. _U_n_i_f_d_e_f copies its output to _s_t_d_o_u_t and will take its input from _s_t_d_i_n if no _f_i_l_e argument is given. If the -c argument is specified, then the operation of _u_n_i_f_d_e_f is complemented, i.e. the lines that would have been removed or blanked are retained and vice versa. SEE ALSO diff(1) 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. BUGS Does not know how to deal with _c_p_p consructs such as #if defined(X) || defined(Y) AUTHOR Dave Yost 4.3 Berkeley Distribution April 29, 1985 UNIFDEF(1)