aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/split
Commit message (Collapse)AuthorAgeFilesLines
* 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
* 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
* Tighten boundary check in split(1) to prevent a potential buffer overflow.Shawn Bayern2024-05-031-0/+4
| | | | | | | | | | | | Before increasing sufflen, make sure the current name plus two (including the terminating NUL character and the to-be-added character) does not exceed the fixed buffer length, and stop immediately if this would occur. In worst case scenario the code would write an nul character beyond the boundary, however it would be caught by open(2) and based on the memory layout, we do not believe this would constitute a security vulnerability. MFC after: 3 days
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-8/+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
* split: Improve GNU compatibility.Dag-Erling Smørgrav2023-09-282-1/+25
| | | | | | | | | | * Like GNU split, turn autoextend back on if given -a0. * Add a test case that verifies that -a<non-zero> turns autoextend off. * Add a test case that verifies that -a0 turns autoextend back on. Sponsored by: Klara, Inc. Reviewed by: christos, kevans Differential Revision: https://reviews.freebsd.org/D42011
* split: Further option parsing improvements.Dag-Erling Smørgrav2023-09-281-38/+46
| | | | | | | | | | * Whenever possible, use strtonum() to parse numeric arguments. * Improve usefulness and consistency of error messages. * While here, fix some type and style issues. Sponsored by: Klara, Inc. Reviewed by: christos, kevans Differential Revision: https://reviews.freebsd.org/D42010
* split: Fix linecount parsing.Dag-Erling Smørgrav2023-09-062-12/+31
| | | | | | | | | The “undocumented kludge” which unfortunately can't be dropped for backward compatibility reasons was prone to segfaulting and would improperly allow a new linecount when one was already set. Fix these issues and add regression tests. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D41757
* split: Code cleanup.Dag-Erling Smørgrav2023-09-061-10/+13
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D41756
* split: Add missing test cases.Dag-Erling Smørgrav2023-09-061-1/+23
| | | | | | | | | This adds test cases for c4f7198f47c1 and ac17fc816e67. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D41755
* 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/
* Mark usage function as __dead2 in programs where it does not returnAlfonso Gregory2023-07-071-1/+1
| | | | | | | | 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
* split(1): add '-c' to continue creating filesJan Schaumann2023-05-302-12/+36
| | | | | | | | | | | | | | | | | | | | | Currently, split(1) will clobber any existing output files: $ split file; ls xaa xab xac xad $ split second-file; ls xaa xab xac xad xae xaf This patch adds a flag "-c" (mnemonic "create, don't overwrite" or "continue where you left off"): $ split file; ls xaa xab xac xad $ split -c second-file; ls xaa xab xac xad xae xaf xag xah xai xaj Reviewed by: christos Approved by: kevans Different Revision: https://reviews.freebsd.org/D38553
* split(1): auto-extend suffix length if requiredJan Schaumann2023-05-302-2/+37
| | | | | | | | | | | | | | | | | | | If the input cannot be split into the number of files resulting from the default suffix length, automatically extend the suffix length rather than bailing out with 'too many files'. Suffixes are extended such that the resulting files continue to sort lexically and "cat *" would reproduce the input. For example, splitting a 1M lines file into (default) 1000 lines per file would yield files named 'xaa', 'xab', ..., 'xyy', 'xyz', 'xzaaa', 'xzaab', ..., 'xzanl'. If '-a' is specified, the suffix length is not auto-extended. This behavior matches GNU sort(1) since around version 8.16. Reviewed by: christos Approved by: kevans Different Revision: https://reviews.freebsd.org/D38279
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+0
|
* split: Update synopsis and usage; fix examplesMateusz Piotrowski2023-04-182-10/+10
| | | | | | | | - Mark -d as an optional flag - Add a prompt to one of the examples for consistency - Add -d to the usage message Sponsored by: Klara Inc.
* split: reset errno prior to getline()Math Ieu2022-10-271-1/+1
| | | | | | | | | Something else may have set errno, breaking the post-getline() logic that tries to detect the getline() error. This was initially noted in a jail on a system that has HPET, in a jail that does not expose /dev/hpet0 -- we see an earlier error in libc's vdso bits. Fixes: 5c053aa3c5e90 ("split: switch to getline() [...]")
* split: add word order fixKyle Evans2022-10-251-1/+1
| | | | | | | This was meant to note that both pattern and line matching were previously restricted, but words are difficult. +line and rearrange. Sponsored by: Klara, Inc.
* split: add some testsKyle Evans2022-10-253-0/+225
| | | | | | | | | | This should cover all of the basic functionality, as well as the recent enhancement to use a dynamic buffer size rather than limiting patterns and lines to MAXBSIZE. Reviewed by: bapt Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D36324
* split: switch to getline() for line/pattern matchingKyle Evans2022-10-252-16/+17
| | | | | | | | | | | Get rid of split's home-grown logic for growing the buffer; arbitrarily breaking at LONG_MAX bytes instead of 65536 bytes gives us much more wiggle room. Additionally, we'll actually fail out entirely if we can't fit a line, which makes noticing this class of problem much easier. Reviewed by: bapt, emaste, pauamma Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D36323
* split(1): Add EXAMPLES sectionFernando Apesteguía2020-06-181-0/+36
| | | | | | | | | | | Add EXAMPLES covering -d, -n and -p Include small explanation about the size of the chunks for the -n option Approved by: 0mp Differential Revision: https://reviews.freebsd.org/D25198 Notes: svn path=/head/; revision=362328
* Revert r352953: Convert pnmatch to single element array in regexec callsAlexander Kabaev2019-10-021-4/+4
| | | | | | | Requested by: cem Notes: svn path=/head/; revision=353011
* Convert pnmatch to single element array in regexec callsAlexander Kabaev2019-10-021-4/+4
| | | | | | | | | | | | | | The regexec function is declared as taking an array of regmatch_t elements, and passing in the pointer to singleton element, while correct, triggers a Coverity warning. Convert the singleton into an array of one to silence the warning. Reported by: Coverity Coverity CID: 1009732, 1009733 MFC after: 2 weeks Notes: svn path=/head/; revision=352953
* 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 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-271-2/+2
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * 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
| * New/updated dependenciesSimon J. Gerraty2014-05-051-0/+1
| | | | | | | | Notes: svn path=/projects/bmake/; revision=265381
| * Merge headSimon J. Gerraty2014-04-282-16/+6
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265044
| * \ Merge from headSimon J. Gerraty2013-09-052-6/+32
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=255263
| * | | 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
* | | | Convert to usr.bin/ to LIBADDBaptiste Daroussin2014-11-251-2/+2
| |_|/ |/| | | | | | | | | | | | | | | | | Reduce overlinking Notes: svn path=/head/; revision=275042
* | | Add missed DPADDEitan Adler2013-11-091-0/+1
| | | | | | | | | | | | | | | | | | | | | Reported by: swildner@DragonflyBSD.org Notes: svn path=/head/; revision=257885
* | | Change manual string conversion to expand_numberEitan Adler2013-11-092-16/+5
| |/ |/| | | | | | | | | | | Reviewed by: adrian Notes: svn path=/head/; revision=257884
* | Avoid signed overflow in error handling code.Eitan Adler2013-05-211-1/+3
| | | | | | | | | | | | | | Reviewed by: cperciva, bjk Notes: svn path=/head/; revision=250882
* | Bump .Dd for recent content change.Eitan Adler2013-05-101-1/+1
| | | | | | | | | | | | | | Reported by: delphij Notes: svn path=/head/; revision=250451
* | Implement 'split -d' which allows a numeric suffix instead of anEitan Adler2013-05-102-5/+29
|/ | | | | | | | | | | | alphabetic one. PR: bin/116209 Submitted by: Marcin Gryszkalis <mg@fork.pl> (adapted from) Reviewed by: will MFC after: 1 week Notes: svn path=/head/; revision=250432
* Fix warning when compiling with gcc46:Eitan Adler2012-01-101-3/+0
| | | | | | | | | | error: variable 'defname' set but not use Approved by: dim MFC after: 3 day Notes: svn path=/head/; revision=229905
* Add missing static keywords to split(1)Ed Schouten2011-11-061-10/+10
| | | | Notes: svn path=/head/; revision=227183
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-112-8/+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
* Correct spelling mistake, int -> intoGavin Atkinson2010-09-021-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=212162