Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/src/cmd/unifdef/unifdef.man

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.\" Copyright (c) 1985, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
.\" Dave Yost.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.TH UNIFDEF 1
.SH NAME
unifdef \- remove ifdef'ed lines from C code
.SH SYNOPSIS
unifdef [
.B -D 
.I name
][
.B -U 
.I name
][
.B -D 
.I name
][
.B -U 
.I name
][
.B -iD 
.I name
][
.B -iU 
.I name
][
.B -clt
][
.I file
]
.SH DESCRIPTION
.I Unifdef
reads the given file or standard input if not specified and
removes the specified  #ifdef, #ifndef, #else, and #endif lines,
simplifying complex C or C++ code.
Ifdefs not specified on the command line are left untouched.
Only one level of ifdef nesting is processed on each pass.
.PP
The ifdef and ifndef'ed symbols to be removed may be specified with
.BI -D name
and
.BI -U name 
respectively;
.PP
If the
.I -c
flag is specified, then these flags are complemented.
.PP
The
.I -l
option causes the replaced lines to be replaced with blank lines
instead of deleting them.
.PP
.I If the file does not contain C or C++ code the -t
option may be useful to disable comment and quote parsing.
.PP
.I Unifdef's comment and quote parsing maybe confused by comments or incomplete code
removed by ifdefs. Such code can be explicitly ignored using the disabled using
.BI -iD name
and
.BI -iU name
in a similar way to the 
.BI -D name
and
.BI -U name
options above.
.SH DIAGNOSTICS
Inappropriate else or endif.
.br
Premature EOF.
.PP
Exit status is 0 if ifdefs where replaced, 1 if no changes where made, 2 if trouble.
.SH BUGS
Does not deal with ``#if'' lines.
.SH HISTORY
The
.I unifdef
command appeared in BSD 4.3 .

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.