BSD 4_3_Net_2 release
[unix-history] / usr / src / usr.bin / unifdef / unifdef.1
index 22b7a89..90e043a 100644 (file)
@@ -1,31 +1,62 @@
-.\" Copyright (c) 1985 The Regents of the University of California.
+.\" Copyright (c) 1985, 1991 The Regents of the University of California.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to Berkeley by
 .\" Dave Yost.
 .\"
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to Berkeley by
 .\" Dave Yost.
 .\"
-.\" %sccs.include.redist.man%
+.\" 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.
 .\"
 .\"
-.\"    @(#)unifdef.1   6.4 (Berkeley) %G%
+.\" 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
-.SH SYNOPSIS
-\fBunifdef\fR
-[
-\fB\-t\fR
-\fB\-l\fR
-\fB\-c\fR
-\fB\-D\fR\fIsym\fR 
-\fB\-U\fR\fIsym\fR 
-\fB\-iD\fR\fIsym\fR
-\fB\-iD\fR\fIsym\fR
-] ...  [ file ]
-.SH DESCRIPTION
-\fIUnifdef\fR is useful for removing ifdef'ed lines
+.\"     @(#)unifdef.1  6.5 (Berkeley) 4/23/91
+.\"
+.Dd April 23, 1991
+.Dt UNIFDEF 1
+.Os BSD 4.3
+.Sh NAME
+.Nm unifdef
+.Nd remove ifdef'ed lines
+.Sh SYNOPSIS
+.Nm unifdef
+.Oo
+.Fl t l c
+.Fl D Ns Ar sym
+.Fl U Ns Ar sym
+.Fl iD Ns Ar sym
+.Fl iD Ns Ar sym
+.Oc
+.Ar ...
+.Op Ar file
+.Sh DESCRIPTION
+.Nm Unifdef
+is useful for removing ifdef'ed lines
 from a file while otherwise leaving the file alone.
 from a file while otherwise leaving the file alone.
-\fIUnifdef\fR acts on
+.Nm Unifdef
+acts on
 #ifdef, #ifndef, #else, and #endif lines,
 and it knows only enough about C
 to know when one of these is inactive
 #ifdef, #ifndef, #else, and #endif lines,
 and it knows only enough about C
 to know when one of these is inactive
@@ -38,21 +69,17 @@ 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.
 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.
-.PP
-If you want to use \fIunifdef\fR
-for plain text (not C code),
-use the \fB\-t\fR option,
-which disables this parsing for
-C comments and quotes.
-.PP
-You specify which symbols you want defined
-(\fB\-D\fR\fIsym\fR)
-or undefined
-(\fB\-U\fR\fIsym\fR)
+.Pp
+Available options:
+.Bl -tag -width Ds -compact
+.It Fl D Ns Ar sym
+.It Fl U Ns Ar sym
+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
 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
-\fIsym\fR will also be removed.
+.Ar sym
+will also be removed.
 Ifdefs involving symbols you don't specify
 and ``#if'' control lines
 are untouched and copied out
 Ifdefs involving symbols you don't specify
 and ``#if'' control lines
 are untouched and copied out
@@ -62,51 +89,78 @@ 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 dominates.
 inside ifdef is treated as if it were an unrecognized symbol.
 If the same symbol appears in more than one argument,
 the last occurrence dominates.
-.PP
-The \fB\-l\fR option causes \fIunifdef\fR
-to replace removed lines with blank lines
+.Pp
+.It Fl c
+If the
+.Fl c
+flag is specified,
+then the operation of
+.Nm unifdef
+is complemented,
+i.e. the lines that would have been removed or blanked
+are retained and vice versa.
+.Pp
+.It Fl l
+Replace removed lines with blank lines
 instead of deleting them.
 instead of deleting them.
-.PP
+.It Fl t
+Disables parsing for
+C comments and quotes useful for plain text
+(not C code).
+.Pp
+.It Fl iD Ns Ar sym
+.It Fl iU Ns Ar sym
+Ignore ifdefs.
 If your C code uses ifdefs to delimit non-C lines,
 such as comments
 or code which is under construction,
 If your C code uses ifdefs to delimit non-C lines,
 such as comments
 or code which is under construction,
-then you must tell \fIunifdef\fR
+then you must tell
+.Nm unifdef
 which symbols are used for that purpose so that it won't try to parse
 for quotes and comments
 inside those ifdefs.
 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
-\fB\-iD\fR\fIsym\fR
+One specifies ignored ifdefs with
+.Fl iD Ns Ar sym
 and
 and
-\fB\-iU\fR\fIsym\fR
+.Fl iU Ns Ar sym
 similar to
 similar to
-\fB\-D\fR\fIsym\fR
+.Fl D Ns Ar sym
 and
 and
-\fB\-U\fR\fIsym\fR
+.Fl U Ns Ar sym
 above.
 above.
-.PP
-\fIUnifdef\fR copies its output to \fIstdout\fR
-and will take its input from \fIstdin\fR
-if no \fIfile\fR argument is given.
-If the \fB\-c\fR argument is specified,
-then the operation of \fIunifdef\fR is complemented,
-i.e. the lines that would have been removed or blanked
-are retained and vice versa.
-.PP
-\fIUnifdef\fR works nicely with the \fB\-D\fR\fIsym\fR option added
-to \fIdiff\fR(1) as of the 4.1 Berkeley Software Distribution.
-.SH "SEE ALSO"
-diff(1)
-.SH DIAGNOSTICS
+.El
+.Pp
+.Nm Unifdef
+copies its output to
+.Em stdout
+and will take its input from
+.Em stdin
+if no
+.Ar file
+argument is given.
+.Pp
+.Nm Unifdef
+works nicely with the
+.Fl D Ns Ar sym
+option added to
+.Xr diff 1
+as of the 4.1 Berkeley Software Distribution.
+.Sh SEE ALSO
+.Xr diff 1
+.Sh DIAGNOSTICS
 Inappropriate else or endif.
 .br
 Inappropriate else or endif.
 .br
-Premature EOF with line numbers of the unterminated #ifdefs.
-.PP
+Premature
+.Tn EOF
+with line numbers of the unterminated #ifdefs.
+.Pp
 Exit status is 0 if output is exact copy of input, 1 if not, 2 if trouble.
 Exit status is 0 if output is exact copy of input, 1 if not, 2 if trouble.
-.SH AUTHOR
-Dave Yost for The Rand Corporation.
-.br
-Still maintained independently by Dave Yost as of 3/85
-.SH BUGS
+.Sh BUGS
 Should try to deal with ``#if'' lines.
 Should try to deal with ``#if'' lines.
-.br
+.Pp
 Doesn't work correctly if input contains null characters.
 Doesn't work correctly if input contains null characters.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 .