History log of /freebsd-current/usr.bin/cmp/cmp.c
Revision Date Author Comments
# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 498a0a9c 07-Jul-2023 Alfonso Gregory <gfunni234@gmail.com>

Mark usage function as __dead2 in programs where it does not return

In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735


# 6673a547 30-Jan-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

cmp: Print a summary on SIGINFO.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D38280


# f1f7f313 21-Oct-2021 Kyle Evans <kevans@FreeBSD.org>

cmp: initialize limit to avoid stack garbage limits

Pointy hat: kevans
Fixes: 4e380e847460 ("cmp: add -n, --bytes to limit number of bytes [...]")
Sponsored by: Klara, Inc.


# f66b9b40 22-Sep-2021 Kyle Evans <kevans@FreeBSD.org>

cmp: add -b, --print-bytes

This is compatible with GNU cmp.

Reviewed by: bapt, markj (earlier version)
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D32074


# 8d546b68 22-Sep-2021 Kyle Evans <kevans@FreeBSD.org>

cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args

This is compatible with GNU cmp.

Reviewed by: markj
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D32073


# 4e380e84 22-Sep-2021 Kyle Evans <kevans@FreeBSD.org>

cmp: add -n, --bytes to limit number of bytes to compare

This is compatible with GNU cmp.

Reviewed by: markj
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D32072


# f6787614 22-Sep-2021 Kyle Evans <kevans@FreeBSD.org>

cmp: accept SI suffixes for skip1 and skip2

This is compatible with GNU cmp.

Reviewed by: bapt (earlier version), markj, imp
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D32071


# 80445b7a 10-Jan-2021 Ed Maste <emaste@FreeBSD.org>

cmp: fix -s (silent) when used with skip offsets

-s causes cmp to print nothing for differing files, for use when only
the exit status is of interest.

-z compares the file size first, for regular files, and fails the
comparison early if they do not match.

Prior to this change -s implied -z as an optimization, but this is not
valid when file offsets are specified. Now, enable the -z optimization
for -s only if both skip arguments are not provided / 0.

Note that using -z with differing skip values will currently always
fail. We may want to compare size1 - skip1 with size2 - skip2 instaead,
and in any case the man page should be clarified.

PR: 252542
Fixes: 3e6902efc802ab57fc4e9bf798f2d271b152e7f9
Reported by: William Ahern
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28071


# 1f766174 10-Jan-2021 Ed Maste <emaste@FreeBSD.org>

cmp: use C99 bool for flags

MFC after: 1 week
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28072


# 2528b7e2 25-Feb-2019 Mark Johnston <markj@FreeBSD.org>

Fix handling of rights on stdio streams, take two.

Split the rights-limiting code into two cases: if one of the input
files isn't a regular file, use caph_limit_stream(3) instead of
open-coding the same logic; if both input files are regular files,
and the initial attempts to map them succeed, we limit the rights on
those files to CAP_MMAP_R.

Add a regression test for PR 234885.

PR: 234885
Reviewed by: delphij
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19216


# 33a28349 20-Jan-2019 Mark Johnston <markj@FreeBSD.org>

Revert r343117.

It breaks the special mode specified by passing "-" as one of the
input files. Revert for now while we discuss a fix.

PR: 234885
Reported by: delphij
MFC after: now


# e6de40fa 17-Jan-2019 Mark Johnston <markj@FreeBSD.org>

Fix handling of rights on stdio streams.

- Limit rights on stdio before opening input files. Otherwise, open()
may return one of the standard descriptors and we end up limiting
rights such that we cannot read from one of the input files.
- Use caph_limit_stdio(), which suppresses EBADF, to ensure that
we don't emit an error if one of the stdio streams is closed.
- Don't bother further limiting rights on stdin when stdin isn't going
to be used. Doing so correctly requires checking for a number of
edge cases, and it doesn't provide any significant benefit.

PR: 234885
Reviewed by: oshogbo
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18860


# 377421df 04-Nov-2018 Mariusz Zaborski <oshogbo@FreeBSD.org>

capsicum: use a new capsicum helpers in tools

Use caph_{rights,ioctls,fcntls}_limit to simplify the code.


# 7672a014 19-Jun-2018 Mariusz Zaborski <oshogbo@FreeBSD.org>

Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.

No functional change intended.


# 8facfdcf 01-May-2018 Kyle Evans <kevans@FreeBSD.org>

cmp(1): Provide some long options

These match GNU cmp(1) for compatibility where applicable.

Future work might implement the -i option from GNU cmp(1) to express skip
either in terms of both files or of the form "SKIP1:SKIP2" rather than
specifying them as additional arguments to cmp(1).

MFC after: 1 month


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# abdfa0b1 07-Oct-2016 Mariusz Zaborski <oshogbo@FreeBSD.org>

Restrict stdin if it's not in use.

Reviewed by: emaste, cem
Differential Revision: https://reviews.freebsd.org/D8184


# a4e3fc54 07-Oct-2016 Mariusz Zaborski <oshogbo@FreeBSD.org>

Remove the duplicated code using Capsicum helpers.

Reviewed by: cem, ed, bapt, emaste
Differential Revision https://reviews.freebsd.org/D8140


# d36899d1 19-Sep-2016 Conrad Meyer <cem@FreeBSD.org>

Move sys/capsicum.h includes after types.h or param.h

This is not actually documented or even implied in style(9). Make the change
to match convention. Someone should document this convention in style(9).

Reported by: jhb
Sponsored by: EMC Dell Isilon


# e75a7302 19-Sep-2016 Conrad Meyer <cem@FreeBSD.org>

cmp(1): Capsicumify

Reviewed by: allanjude, bapt, oshogbo
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D7912


# da52b4ca 11-Dec-2010 Joel Dahl <joel@FreeBSD.org>

Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with: imp, rwatson


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# e1bfde1b 23-Aug-2005 Brian Somers <brian@FreeBSD.org>

Add a -h option to tell cmp not to follow symbolic links.

MFC after: 3 weeks
Sponsored by: Sophos/ActiveState


# f2e8e0da 28-Jul-2002 David Malone <dwmalone@FreeBSD.org>

ANSIify function definitions to avoid a warning.


# 6e473901 06-Jun-2002 Tim J. Robbins <tjr@FreeBSD.org>

No need to check for "-" explicitly in getopt() loop.


# c8718058 06-Jun-2002 Tim J. Robbins <tjr@FreeBSD.org>

Exit >1 when an error occurs, regardless of whether -s is specified (SUSv3)


# f1bb2cd2 21-Mar-2002 Warner Losh <imp@FreeBSD.org>

remove __P


# 9f5b04e9 10-Dec-2001 David Malone <dwmalone@FreeBSD.org>

Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.


# 6af414cb 02-Dec-2001 Mark Murray <markm@FreeBSD.org>

Turn on WARNS=2.
Use __FBSDID().


# c5250ed1 05-Nov-2001 David Malone <dwmalone@FreeBSD.org>

Make filenames const to avoid a few warnings.
Add FreeBSD tags.

Reviewed by: cmp


# 1727cb4c 25-Jul-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Fix a bug introduced in rev 1.8, where special files ended up
being treated like regular files because of missing braces.

PR: 20143


# 3e6902ef 14-Jul-2000 Brian Somers <brian@FreeBSD.org>

Add the -z flag to check file sizes first
Correct the cmp.1 usage message
Correct the -l/-s incompatibility message

Submitted by: Mark Knight <markk@knigma.org>


# e03983a3 15-May-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Let cmp(1) grow in -x option to print differences in contemporarry hex
format rather than the mixed decimal/octal format of -l.


# fa146c53 06-Dec-1998 Archie Cobbs <archie@FreeBSD.org>

Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]).


# 1e17b945 19-Aug-1997 Jonathan Lemon <jlemon@FreeBSD.org>

Permit hex/octal parameters to cmp, to match what the manual page says.

PR: 3850, 3855


# f771f052 26-Jun-1997 Philippe Charnier <charnier@FreeBSD.org>

Correct usage string. Program name converted to bold in man page.


# 1c8af878 28-Mar-1997 Warner Losh <imp@FreeBSD.org>

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# e5266259 20-Aug-1994 Jordan K. Hubbard <jkh@FreeBSD.org>

I don't like what they did to cmp(1) in 4.4 Lite; now it whines all
the time, even with -s. Make cmp SHUT UP about non-existant files
when run with -s.
Submitted by: jkh


# 9b50d902 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Usr.bin Sources