Print this page
13507 some man pages need update following 13405
6308 some man pages are obsolete after moving to ksh builtins
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/cmp.1
+++ new/usr/src/man/man1/cmp.1
1 -.\"
2 1 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 2 .\" permission to reproduce portions of its copyrighted documentation.
4 3 .\" Original documentation from The Open Group can be obtained online at
5 4 .\" http://www.opengroup.org/bookstore/.
6 5 .\"
7 6 .\" The Institute of Electrical and Electronics Engineers and The Open
8 7 .\" Group, have given us permission to reprint portions of their
9 8 .\" documentation.
10 9 .\"
11 10 .\" In the following statement, the phrase ``this text'' refers to portions
12 11 .\" of the system documentation.
13 12 .\"
14 13 .\" Portions of this text are reprinted and reproduced in electronic form
15 14 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 15 .\" Standard for Information Technology -- Portable Operating System
17 16 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 17 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 18 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 19 .\" between these versions and the original IEEE and The Open Group
21 20 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 21 .\" document. The original Standard can be obtained online at
23 22 .\" http://www.opengroup.org/unix/online.html.
24 23 .\"
25 24 .\" This notice shall appear on any product containing this material.
26 25 .\"
27 26 .\" The contents of this file are subject to the terms of the
28 27 .\" Common Development and Distribution License (the "License").
29 28 .\" You may not use this file except in compliance with the License.
30 29 .\"
31 30 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 31 .\" or http://www.opensolaris.org/os/licensing.
33 32 .\" See the License for the specific language governing permissions
34 33 .\" and limitations under the License.
35 34 .\"
↓ open down ↓ |
24 lines elided |
↑ open up ↑ |
36 35 .\" When distributing Covered Code, include this CDDL HEADER in each
37 36 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 37 .\" If applicable, add the following below this CDDL HEADER, with the
39 38 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 39 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 40 .\"
42 41 .\"
43 42 .\" Copyright 1989 AT&T
44 43 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
45 44 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
45 +.\" Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
46 46 .\"
47 -.TH CMP 1 "Jul 19, 2006"
48 -.SH NAME
49 -cmp \- compare two files
50 -.SH SYNOPSIS
51 -.LP
52 -.nf
53 -\fBcmp\fR [\fB-l\fR | \fB-s\fR] \fIfile1\fR \fIfile2\fR [\fIskip1\fR] [\fIskip2\fR]
54 -.fi
55 -
56 -.SH DESCRIPTION
57 -.sp
58 -.LP
59 -The \fBcmp\fR utility compares two files. \fBcmp\fR writes no output if the
60 -files are the same. Under default options, if they differ, it writes to
61 -standard output the byte and line numbers at which the first difference
62 -occurred. Bytes and lines are numbered beginning with 1. If one file is an
63 -initial subsequence of the other, that fact is noted. \fIskip1\fR and
64 -\fIskip2\fR are initial byte offsets into \fIfile1\fR and \fIfile2\fR
65 -respectively, and can be either octal or decimal. A leading 0 denotes octal.
66 -.SH OPTIONS
67 -.sp
68 -.LP
47 +.Dd Feb 9, 2021
48 +.Dt CMP 1
49 +.Os
50 +.Sh NAME
51 +.Nm cmp
52 +.Nd compare two files
53 +.Sh SYNOPSIS
54 +.Nm
55 +.Op Fl bcdilns
56 +.Ar file1 file2
57 +.Op Ar skip1 Op Ar skip2
58 +.Sh DESCRIPTION
59 +The
60 +.Nm
61 +utility compares two files.
62 +.Nm
63 +writes no output if the files are the same.
64 +Under default options, if they differ, it writes to standard output the byte
65 +and line numbers at which the first difference occurred.
66 +Bytes and lines are numbered beginning with 1.
67 +.Ar skip1
68 +and
69 +.Ar skip2
70 +are initial byte offsets into
71 +.Ar file1
72 +and
73 +.Ar file2
74 +respectively, and are specified in bytes or can be given with a suffix of
75 +.Cm k
76 +for kilobytes or
77 +.Cm m
78 +for megabytes.
79 +.Lp
80 +If either
81 +.Ar file1
82 +or
83 +.Ar file2
84 +is a dash
85 +.Pq Ar \(mi ,
86 +.Nm
87 +uses standard input starting at the current location.
88 +.Sh OPTIONS
69 89 The following options are supported:
70 -.sp
71 -.ne 2
72 -.na
73 -\fB\fB-l\fR\fR
74 -.ad
75 -.RS 6n
90 +.Bl -tag -width Ar
91 +.It Fl b Ns \&, Fl \-print-bytes
92 +Print differing bytes as 3-digit octal values.
93 +.It Fl c Ns \&, Fl \-print-chars
94 +Print differing bytes as follows:
95 +.Bl -bullet -width Ds
96 +.It
97 +non-space printable characters as themselves;
98 +.It
99 +space and control characters as
100 +.Em ^
101 +followed by a letter of the alphabet;
102 +.It
103 +characters with the high bit set as the lower 7-bit character prefixed by
104 +.Em M^
105 +for 7-bit space and non-printable characters, and
106 +.Em M-
107 +for all other characters.
108 +If the 7-bit character encoding is not ASCII then the characters are converted
109 +to ASCII to determine whether the high bit is set and, if set, it is cleared
110 +and converted back to the native encoding.
111 +Multibyte characters in the current locale are treated as printable characters.
112 +.El
113 +.It Fl d Ar differences Ns \&, Fl \-differences Ns = Ns Ar differences
114 +Print at most
115 +.Ar differences
116 +differences using
117 +.Fl l
118 +.Pq Fl -verbose
119 +output format.
120 +If
121 +.Ar differences
122 +is
123 +.Cm 0
124 +then this is equivalent to passing the
125 +.Fl s
126 +or
127 +.Fl \-silent
128 +option.
129 +.It Fl i Ar skip1 Ns Op : Ns Ar skip2 Ns \&, Fl -skip Ns = Ns Ar skip1 Ns Op : Ns Ar skip2 Ns \&, Fl -ignore-initial Ns = Ns Ar skip1 Ns Op : Ns Ar skip2
130 +Skip the first
131 +.Ar skip1
132 +bytes in
133 +.Ar file1
134 +and the first
135 +.Ar skip2
136 +bytes in
137 +.Ar file2 .
138 +If
139 +.Ar skip2
140 +is omitted then
141 +.Ar skip1
142 +is used for that value.
143 +The default value is
144 +.Ar 0:0 .
145 +.It Fl l Ns \&, Fl \-verbose
76 146 Write the byte number (decimal) and the differing bytes (octal) for each
77 147 difference.
78 -.RE
79 -
80 -.sp
81 -.ne 2
82 -.na
83 -\fB\fB-s\fR\fR
84 -.ad
85 -.RS 6n
86 -Write nothing for differing files. Return exit status only.
87 -.RE
88 -
89 -.SH OPERANDS
90 -.sp
91 -.LP
148 +.It Fl n Ar count Ns \&, Fl \-count Ns = Ns Ar count Ns \&, Fl \-bytes Ns = Ns Ar count
149 +Compare at most
150 +.Ar count
151 +bytes.
152 +.It Fl s Ns \&, Fl \-silent \&, Fl \-quiet
153 +Write nothing for differing files.
154 +Return exit status only.
155 +.El
156 +.Sh OPERANDS
92 157 The following operands are supported:
93 -.sp
94 -.ne 2
95 -.na
96 -\fB\fIfile1\fR\fR
97 -.ad
98 -.RS 9n
99 -A path name of the first file to be compared. If \fIfile1\fR is \fB\(mi\fR, the
100 -standard input is used.
101 -.RE
102 -
103 -.sp
104 -.ne 2
105 -.na
106 -\fB\fIfile2\fR\fR
107 -.ad
108 -.RS 9n
109 -A path name of the second file to be compared. If \fIfile2\fR is \fB\(mi\fR,
158 +.Bl -tag -width Ar
159 +.It Ar file1
160 +A path name of the first file to be compared.
161 +If
162 +.Ar file1
163 +is
164 +.Ar \(mi ,
110 165 the standard input is used.
111 -.RE
112 -
113 -.sp
114 -.LP
115 -If both \fIfile1\fR and \fIfile2\fR refer to standard input or refer to the
116 -same \fBFIFO\fR special, block special or character special file, an error
117 -results.
118 -.SH USAGE
119 -.sp
120 -.LP
121 -See \fBlargefile\fR(5) for the description of the behavior of \fBcmp\fR when
122 -encountering files greater than or equal to 2 Gbyte (2^31 bytes).
123 -.SH EXAMPLES
124 -.LP
125 -\fBExample 1 \fRComparing Files Byte for Byte
126 -.sp
127 -.LP
128 -The following example does a byte for byte comparison of \fIfile1\fR and
129 -\fIfile2\fR:
130 -
131 -.sp
132 -.in +2
133 -.nf
134 -example% \fBcmp file1 file2 0 1024\fR
135 -.fi
136 -.in -2
137 -.sp
138 -
139 -.sp
140 -.LP
141 -It skips the first 1024 bytes in \fIfile2\fR before starting the comparison.
142 -
143 -.SH ENVIRONMENT VARIABLES
144 -.sp
145 -.LP
146 -See \fBenviron\fR(5) for descriptions of the following environment variables
147 -that affect the execution of \fBcmp\fR: \fBLANG\fR, \fBLC_ALL\fR,
148 -\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
149 -.SH EXIT STATUS
150 -.sp
151 -.LP
152 -The following error values are returned:
153 -.sp
154 -.ne 2
155 -.na
156 -\fB\fB0\fR\fR
157 -.ad
158 -.RS 6n
159 -The files are identical.
160 -.RE
161 -
162 -.sp
163 -.ne 2
164 -.na
165 -\fB\fB1\fR\fR
166 -.ad
167 -.RS 6n
168 -The files are different. This includes the case where one file is identical to
169 -the first part of the other.
170 -.RE
171 -
172 -.sp
173 -.ne 2
174 -.na
175 -\fB\fB>1\fR\fR
176 -.ad
177 -.RS 6n
178 -An error occurred.
179 -.RE
180 -
181 -.SH ATTRIBUTES
182 -.sp
183 -.LP
184 -See \fBattributes\fR(5) for descriptions of the following attributes:
185 -.sp
186 -
187 -.sp
188 -.TS
189 -box;
190 -c | c
191 -l | l .
192 -ATTRIBUTE TYPE ATTRIBUTE VALUE
193 -_
194 -CSI Enabled
195 -_
196 -Interface Stability Standard
197 -.TE
198 -
199 -.SH SEE ALSO
200 -.sp
201 -.LP
202 -\fBcomm\fR(1), \fBdiff\fR(1), \fBattributes\fR(5), \fBenviron\fR(5),
203 -\fBlargefile\fR(5), \fBstandards\fR(5)
166 +.It Ar file2
167 +A path name of the second file to be compared.
168 +If
169 +.Ar file2
170 +is
171 +.Ar \(mi ,
172 +the standard input is used.
173 +.It Ar skip1
174 +The number of initial bytes from
175 +.Ar file1
176 +to skip before beginning the comparison.
177 +.It Ar skip2
178 +The number of initial bytes from
179 +.Ar file2
180 +to skip before beginning the comparison.
181 +If
182 +.Ar skip1
183 +is specified but
184 +.Ar skip2
185 +is not, then the value of
186 +.Ar skip1
187 +is also implicitly used for
188 +.Ar skip2 .
189 +.El
190 +.Pp
191 +If both
192 +.Ar file1
193 +and
194 +.Ar file2
195 +refer to standard input or refer to the same FIFO, block or character special
196 +file, an error results.
197 +.Pp
198 +.Ar skip
199 +values are specified in bytes, or can be suffixed with
200 +.Cm k
201 +.Pq for kilobytes
202 +or
203 +.Cm m
204 +.Pq for megabytes.
205 +.Sh EXIT STATUS
206 +The following exit values are returned:
207 +.Bl -tag -width Ds
208 +.It Sy 0
209 +The files or portions compared are identical.
210 +.It Sy 1
211 +The files or portions compared are different.
212 +.It Sy >1
213 +An error ocurred.
214 +.El
215 +.Sh EXAMPLES
216 +.Bl -tag -width Ds
217 +.It Sy Example 1 No Comparing Files Byte for Byte
218 +The following example does a byte for byte comparison of
219 +.Ar file1
220 +and
221 +.Ar file2 ,
222 +skipping the first 1024 bytes in
223 +.Ar file2
224 +before starting the comparison.
225 +.Bd -literal
226 +$ cmp file1 file2 0 1024
227 +.Ed
228 +.El
229 +.Sh ENVIRONMENT VARIABLES
230 +See
231 +.Xr environ 5
232 +for descriptions of the following environment variables
233 +that affect the execution of
234 +.Nm :
235 +.Ev LANG ,
236 +.Ev LC_ALL ,
237 +.Ev LC_TYPE ,
238 +.Ev LC_MESSAGES ,
239 +.Ev LC_NUMERIC ,
240 +and
241 +.Ev NLSPATH .
242 +.Sh INTERFACE STABILITY
243 +The command line interface of
244 +.Nm
245 +is
246 +.Sy Committed .
247 +The output of
248 +.Nm
249 +is
250 +.Sy Standard .
251 +.Sh SEE ALSO
252 +.Xr comm 1 ,
253 +.Xr diff 1 ,
254 +.Xr attributes 5 ,
255 +.Xr environ 5 ,
256 +.Xr largefile 5 ,
257 +.Xr standards 5
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX