UNIFDEF(1) 1988 UNIFDEF(1) NNAAMMEE unifdef - remove ifdef'ed lines SSYYNNOOPPSSIISS uunniiffddeeff [ --tt --ll --cc --DD_s_y_m --UU_s_y_m --iiDD_s_y_m --iiDD_s_y_m ] ... [ file ] DDEESSCCRRIIPPTTIIOONN _U_n_i_f_d_e_f is useful for removing ifdef'ed lines from a file while otherwise leaving the file alone. _U_n_i_f_d_e_f acts on #ifdef, #ifndef, #else, and #endif lines, and it knows only enough about C to know when one of these is inactive because it is inside a comment, or a single or double quote. Pars- ing for quotes is very simplistic: when it finds an open quote, it ignores everything (except escaped quotes) until it finds a close quote, and it will not complain if it gets to the end of a line and finds no backslash for continua- tion. If you want to use _u_n_i_f_d_e_f for plain text (not C code), use the --tt option, which disables this parsing for C comments and quotes. You specify which symbols you want defined (--DD_s_y_m) or unde- fined (--UU_s_y_m) and the lines inside those ifdefs will be copied to the output or removed as appropriate. The ifdef, ifndef, else, and endif lines associated with _s_y_m will also be removed. Ifdefs involving symbols you don't specify and ``#if'' control lines 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 sym- bol. If the same symbol appears in more than one argument, the last occurrence dominates. The --ll option causes _u_n_i_f_d_e_f to replace removed lines with blank lines instead of deleting them. If your C code uses 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 inside those ifdefs. You specify ignored ifdefs with --iiDD_s_y_m and --iiUU_s_y_m similar to --DD_s_y_m and --UU_s_y_m above. _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 --cc 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. _U_n_i_f_d_e_f works nicely with the --DD_s_y_m option added to _d_i_f_f(1) as of the 4.1 Berkeley Software Distribution. Printed 7/27/90 December 1 UNIFDEF(1) 1988 UNIFDEF(1) SSEEEE AALLSSOO diff(1) DDIIAAGGNNOOSSTTIICCSS Inappropriate else or endif. Premature EOF with line numbers of the unterminated #ifdefs. Exit status is 0 if output is exact copy of input, 1 if not, 2 if trouble. AAUUTTHHOORR Dave Yost for The Rand Corporation. Still maintained independently by Dave Yost as of 3/85 BBUUGGSS Should try to deal with ``#if'' lines. Doesn't work correctly if input contains null characters. Printed 7/27/90 December 2