*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->NetBSD man pages -> unifdef (1)              



NAME    [Toc]    [Back]

     unifdef - remove ifdef'ed lines

SYNOPSIS    [Toc]    [Back]

     unifdef [-clt] [-Dsym -Usym -iDsym -iDsym] ... [file]

DESCRIPTION    [Toc]    [Back]

     unifdef is useful for removing ifdef'ed lines from a file while otherwise
     leaving the file alone.  unifdef 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.
     Parsing 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 continuation.

     Available options:
     -Usym   Specify which symbols to define or undefine.  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 sym 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 symbol.  If the
             same symbol appears in more than one argument, the last occurrence

     -c      If the -c flag is specified, then the operation of unifdef is
             complemented, i.e. the lines that would have been removed or
             blanked are retained and vice versa.

     -l      Replace removed lines with blank lines instead of deleting them.
     -t      Disables parsing for C comments and quotes, which is useful for
             plain text.

     -iUsym  Ignore ifdefs.  If your C code uses 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 inside those
             ifdefs.  One specifies ignored ifdefs with -iDsym and -iUsym similar
 to -Dsym and -Usym above.

     unifdef copies its output to stdout and will take its input from stdin if
     no file argument is given.

     unifdef works nicely with the -Dsym option added to diff(1) as of the 4.1
     Berkeley Software Distribution.

DIAGNOSTICS    [Toc]    [Back]

     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.

SEE ALSO    [Toc]    [Back]


HISTORY    [Toc]    [Back]

     The unifdef command appeared in 4.3BSD.

BUGS    [Toc]    [Back]

     Should try to deal with ``#if'' lines.

     Doesn't work correctly if input contains null characters.

BSD                              April 1, 1994                             BSD
[ Back ]
 Similar pages
Name OS Title
unifdef HP-UX remove preprocessor lines
uniq Linux remove duplicate lines from a sorted file
paste HP-UX merge same lines of several files or subsequent lines of one file
paste IRIX merge same lines of several files or subsequent lines of one file
paste Tru64 Joins corresponding lines of several files or subsequent lines in one file
linesmooth IRIX specify antialiasing of lines
head IRIX give first few lines
head HP-UX give first few lines
unifdef Tru64 Removes #ifdefed lines
curs_refresh IRIX refresh curses windows and lines
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service