aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/cmp/regular.c
Commit message (Collapse)AuthorAgeFilesLines
* cmp: Check the status of stdout.Dag-Erling Smørgrav2024-10-091-16/+19
| | | | | | | | | | POSIX requires us to print an error message and exit non-zero if writing to stdout fails. This can only happen if sflag is unset. MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47020
* cmp: Style and type issues.Dag-Erling Smørgrav2024-10-091-0/+1
| | | | | | | MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: 0mp, markj Differential Revision: https://reviews.freebsd.org/D47019
* usr.bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-4/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-271-3/+0
| | | | | | | | 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
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* cmp: Print a summary on SIGINFO.Dag-Erling Smørgrav2023-01-311-0/+7
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D38280
* cmp: add -b, --print-bytesKyle Evans2021-09-291-3/+7
| | | | | | | | This is compatible with GNU cmp. Reviewed by: bapt, markj (earlier version) Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32074
* cmp: add -n, --bytes to limit number of bytes to compareKyle Evans2021-09-291-3/+5
| | | | | | | | This is compatible with GNU cmp. Reviewed by: markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D32072
* Fix handling of rights on stdio streams, take two.Mark Johnston2019-02-251-8/+17
| | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=344551
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=314436
* Eliminate unneeded headers.Xin LI2011-06-211-2/+0
| | | | Notes: svn path=/head/; revision=223376
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-111-4/+0
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=216370
* Revert most part of 200420 as requested, as more review and polish isXin LI2009-12-131-0/+2
| | | | | | | needed. Notes: svn path=/head/; revision=200462
* Remove unneeded header includes from usr.bin/ except contributed code.Xin LI2009-12-111-2/+0
| | | | | | | Tested with: make universe Notes: svn path=/head/; revision=200420
* add __unused to succeed at WARNS=6Philippe Charnier2008-07-101-1/+1
| | | | Notes: svn path=/head/; revision=180426
* The cmp utility has the questionable feature of using mmap whenDavid Schultz2003-02-261-0/+21
| | | | | | | | | | | | | | comparing regular files. Add a SIGSEGV handler to make its behavior less surprising when a read error occurs. The handler does not attempt to distinguish errors from file truncation, but anyone actively modifying a file while trying to compare it shouldn't even expect something sane to happen. PR: 45391 Reviewed by: mike (mentor) Notes: svn path=/head/; revision=111538
* ANSIify function definitions to avoid a warning.David Malone2002-07-281-8/+3
| | | | Notes: svn path=/head/; revision=100815
* remove __PWarner Losh2002-03-221-1/+1
| | | | Notes: svn path=/head/; revision=92920
* Style improvements recommended by Bruce as a follow up to someDavid Malone2001-12-101-5/+6
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=87628
* Cast off_t to long long before printing. Use %ll instead of %q incaseDavid Malone2001-12-031-2/+4
| | | | | | | long long and quad_t are not the same. Notes: svn path=/head/; revision=87282
* Turn on WARNS=2.Mark Murray2001-12-021-4/+5
| | | | | | | Use __FBSDID(). Notes: svn path=/head/; revision=87241
* Make filenames const to avoid a few warnings.David Malone2001-11-051-1/+1
| | | | | | | | | Add FreeBSD tags. Reviewed by: cmp Notes: svn path=/head/; revision=86099
* Make cmp work by mmapping chunks of a file, rather than the wholeDavid Malone2001-11-041-14/+52
| | | | | | | | | | | file at one time. PR: 24732 Submitted by: Andrew L. Neporada <andr@dgap.mipt.ru> MFC after: 2 weeks Notes: svn path=/head/; revision=86044
* Make cmp -s work properly if skip values are given. Also, exit(1)Brian Feldman2000-06-201-3/+3
| | | | | | | | | | | is now exit(DIFF_EXIT). PR: 18597 Submitted by: Anatoly Vorobey <mellon@pobox.com> Committed at: Usenix terminal room Notes: svn path=/head/; revision=61883
* Oops, byte offset was as off_t.Poul-Henning Kamp2000-05-151-1/+1
| | | | Notes: svn path=/head/; revision=60586
* Let cmp(1) grow in -x option to print differences in contemporarry hexPoul-Henning Kamp2000-05-151-1/+7
| | | | | | | format rather than the mixed decimal/octal format of -l. Notes: svn path=/head/; revision=60583
* Fix improper mmap length paramater which can result in improper behaviorBrian Feldman1999-07-291-7/+9
| | | | | | | or cmp crashing in specific cases. Notes: svn path=/head/; revision=49235
* More egcs warning fixes:Warner Losh1999-04-251-1/+2
| | | | | | | | | | | | | o main returns int not void o use return 0 at end of main when needed o use braces to avoid potentially ambiguous else o don't default to type int o #ifdef 0 -> #if 0 Reviewed by: obrien and chuckr Notes: svn path=/head/; revision=46081
* Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]).Archie Cobbs1998-12-061-1/+1
| | | | Notes: svn path=/head/; revision=41568
* Sweep through the tree fixing mmap() usage:Alexander Langer1997-01-161-2/+2
| | | | | | | | | | | | | | | - Use MAP_FAILED instead of the constant -1 to indicate failure (required by POSIX). - Removed flag arguments of '0' (required by POSIX). - Fixed code which expected an error return of 0. - Fixed code which thought any address with the high bit set was an error. - Check for failure where no checks were present. Discussed with: bde Notes: svn path=/head/; revision=21786
* Our mmap(2) has a limitation where the `offset' parameter must beJoerg Wunsch1997-01-081-2/+12
| | | | | | | | | | page-aligned. cmp(1) should know about this flaw, and work around it. While i was at it, fixed an uninitialized variable as reported by -Wall. Notes: svn path=/head/; revision=21429
* When mmap is used, do an madvise(MADV_SEQUENTIAL) to make thingsJohn Dyson1996-12-111-0/+3
| | | | | | | | go much more quickly when file input is really done. Of course, the fully cached case will make no difference. Notes: svn path=/head/; revision=20312
* BSD 4.4 Lite Usr.bin SourcesRodney W. Grimes1994-05-271-0/+98
Notes: svn path=/cvs2svn/branches/CHRISTOS/; revision=1590