aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/wc
Commit message (Collapse)AuthorAgeFilesLines
* manpages: prefer linking to xo_options.7 over xo_parse_args.3Alan Somers2025-07-161-3/+3
| | | | | | | | | | | | | | | Most libxo-enabled utilities link to xo_parse_args.3. But that man page doesn't actually describe how to format command-line arguments. Rather, xo_options.7 does. I suspect that these utilities link to the former because the latter man page did not exist until libxo-0.7.2 (8a6eceff3ce). And newer utilities have probably been copy/pasting the same text from older ones. But the superior man page does exist now, so we should link to it instead. MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D51354
* Update Makefile.depend filesSimon J. Gerraty2024-10-141-0/+10
| | | | | | | After building packages we have a number of new and updated Makefile.depend files Reviewed by: stevek
* wc: Add version information to libxo outputBram2024-09-061-0/+4
| | | | | | | | Add version information to libxo output so that libxo content consumers can track changes. Reviewed by: imp, markj Pull Request: https://github.com/freebsd/freebsd-src/pull/1350
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* wc: Fix SIGINFO race with casper init.Bryan Drewery2024-02-181-2/+1
| | | | | | | If a file is specified then fileargs_init(3) may return [EINTR]. With the SIGINFO handler not being SA_RESTART this causes an early exit if a SIGINFO comes in. Rather than checking for [EINTR] or changing the handler just move it later which resolves the problem.
* wc: Do not use st_size if it equals zeroRicardo Branco2024-02-031-1/+2
| | | | | | | | | | Pseudo-filesystems often cannot compute the size of the file correctly and report 0 for the size. Ignore the size when it's zero and fallback to the size unknown code. PR: 276093 Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/985
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-10/+0
| | | | | | | | | | | 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
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-273-6/+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 nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-164-4/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-3/+1
|
* wc: Make the read buffer static.Dag-Erling Smørgrav2023-02-161-2/+3
| | | | | | | | | | The read buffer in cnt() is 64 kB, which is a bit excessive for a stack variable. MAXBSIZE has grown since this code was originally written, and it might grow again in the future. Since the program is single-threaded and cnt() does not recurse, we can safely make the buffer static. While there, constify p since it is only used to read. Sponsored by: Klara, Inc. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38608
* wc: Improve test coverage.Dag-Erling Smørgrav2023-02-161-0/+51
| | | | | | | | | | * Add a test that causes mbrtowc() to return 0. * Add a test that causes mbrtowc() to return -2. Sponsored by: Klara, Inc. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D38605
* wc: Clean up and modernize.Dag-Erling Smørgrav2023-02-144-73/+277
| | | | | | | | | | | | | | | | | | | | * Drop <err.h>, which is unnecessary since we use libxo. * As per POSIX, report an error if output fails. * Fix some type mismatches. * Use bool instead of int where appropriate. * Avoid repeatedly checking for a null filename. * Miscellaneous other tidying. * Add tests (partly derived from work performed by SHENG-YI HONG <i19780219111@kimo.com>). Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D38496
* wc(1): document SIGINFO handling in the manual page.Eugene Grosbein2020-04-111-1/+13
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=359801
* wc(1): account for possibility of file == NULLKyle Evans2020-02-051-2/+2
| | | | | | | | | | | | file could reasonably be NULL here if we we're using stdin. Albeit less likely in normal usage, one could actually hit either of these warnings on stdin. ubmitted by: sigsys@gmail.com MFC after: 3 days Notes: svn path=/head/; revision=357572
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-1/+2
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* Add Makefile.depend.optionsSimon J. Gerraty2019-12-111-0/+8
| | | | | | | | | | | | | | | | | | | | Leaf directories that have dependencies impacted by options need a Makefile.depend.options file to avoid churn in Makefile.depend DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc can be set in local.dirdeps-options.mk which can add to those set in Makefile.depend.options See share/mk/dirdeps-options.mk Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22469 Notes: svn path=/head/; revision=355616
* cap_fileargs: chase r346315, update fileargs_init in consumersEd Maste2019-04-171-1/+1
| | | | | | | | | | Reported by: ci.freebsd.org (8 times so far) MFC after: 3 weeks MFC with: r346315 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=346316
* s/caph_enter_capser/caph_enter_casper/gMariusz Zaborski2018-11-121-1/+1
| | | | | | | Reported by: npn Notes: svn path=/head/; revision=340382
* s/caph_enter_with_casper/caph_enter_casper/Mariusz Zaborski2018-11-121-1/+1
| | | | | | | Reported by: npn Notes: svn path=/head/; revision=340380
* wc: We should sandbox wc only if Capers is available.Mariusz Zaborski2018-11-121-1/+1
| | | | Notes: svn path=/head/; revision=340377
* wc: sandbox wc using capsicumMariusz Zaborski2018-11-122-1/+37
| | | | | | | | Reviewed by: AllanJude, emaste Differential Revision: https://reviews.freebsd.org/D14409 Notes: svn path=/head/; revision=340374
* wc(1): Fix 'wc -L'Conrad Meyer2018-08-022-13/+12
| | | | | | | | | | | | | | | | I inadvertently broke 'wc -L' in r326736. We must skip the fast path if -L was specified, in addition to the existing check for the -l option. Document long-standing -L behavior (count varies depending on whether wc(1) is run with the -m option or not) in wc.1. That behavior dates back to the introduction of the -L option, but was not documented. PR: 230300 Reported by: <amstrnad+bugzilla AT gmail.com> Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=337203
* wc(1): Restore regular file char count fast pathConrad Meyer2017-12-101-44/+41
| | | | | | | | | | | | | fstat(2) is going to be a lot faster than reading all of the bytes in a file, if we just need a character count for a regular file. This fast path was accidentally broken in r326736. PR: 224160 Reported by: bde Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=326749
* wc(1): Extend non-controversial optimizations to '-c' modeConrad Meyer2017-12-091-50/+51
| | | | | | | | | | | | | | | | | | | | | | wc(1)'s slow path for counting words or multibyte characters requires conversion of the 8-bit input stream to wide characters. However, a faster path can be used for counting only lines ('-l' -- newlines have the same representation in all supported encodings) or bytes ('-c'). The existing line count optimization was not used if the input was the implicit stdin. Additionally, it wasn't used if only byte counting was requested. This change expands the fast path to both of these scenarios. Expanding the buffer size from 64 kB helps reduce the number of read(2) calls needed, but exactly what impact that change has and what size to expand the buffer to are still under discussion. PR: 224160 Tested by: wosch (earlier version) Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=326736
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | 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
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Renumber copyright clause 4Warner Losh2017-02-282-2/+2
| | | | | | | | | | | | 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
* Add more text to explain --libxo flag.Craig Rodrigues2015-12-011-1/+8
| | | | Notes: svn path=/head/; revision=291607
* Make libxo depend on libutil because it uses humanize_number after r287111Enji Cooper2015-10-181-1/+1
| | | | | | | | | | | Remove overlinking in lib/libxo/tests, sbin/savecore, and usr.bin/{iscsictl,wc,xo} PR: 203673 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=289490
* Update META_MODE dependencies.Bryan Drewery2015-09-171-0/+1
| | | | Notes: svn path=/head/; revision=287905
* Upgrade libxo to 0.4.5.Marcel Moolenaar2015-08-241-1/+1
| | | | | | | | | | Local changes incorporated by 0.4.5: r284340 Local changes retained: r276260, r282117 Obtained from: https://github.com/Juniper/libxo Notes: svn path=/head/; revision=287111
* Clean out some externally visible "more then" grammarPedro F. Giffuni2015-08-111-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=286615
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-272-3/+15
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Updated/new dependenciesSimon J. Gerraty2014-11-191-0/+1
| | | | | | | | Notes: svn path=/projects/bmake/; revision=274694
| * Merge from head@274682Simon J. Gerraty2014-11-193-19/+45
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=274683
| * | Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | Fix SIGINFO race causing final results to be lost to stderr.Bryan Drewery2015-04-161-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a SIGINFO comes in after the file is read then the 'siginfo' flag is set to 1 and the next call to show_cnt() (at exit) would print the data to stderr rather than the expected stdout. This was found with spamming Poudriere with SIGINFO which caused a 'wc -l' execution to return no data rather than an expected number. MFC after: 2 weeks Notes: svn path=/head/; revision=281617
* | | Close the file list before opening the container that holds theMarcel Moolenaar2015-02-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | totals, otherwise we end up emitting invalid JSON -- provided libxo does not prevent us from doing that. PR: 197499 Submitted by: allanjude@ Notes: svn path=/head/; revision=278590
* | | Convert to usr.bin/ to LIBADDBaptiste Daroussin2014-11-251-2/+1
| |/ |/| | | | | | | | | | | Reduce overlinking Notes: svn path=/head/; revision=275042
* | Fix a SIGSEGV when emitting XML or JSON when reading stdin. In thatMarcel Moolenaar2014-11-071-3/+1
| | | | | | | | | | | | | | case the file variable is NULL. Notes: svn path=/head/; revision=274210
* | Separate references by a comma.Marcel Moolenaar2014-11-061-2/+2
| | | | | | | | Notes: svn path=/head/; revision=274180