Commit Graph

30 Commits

Author SHA1 Message Date
Alexander Kabaev
bcd34af473 Revert r352953: Convert pnmatch to single element array in regexec calls
Requested by: cem
2019-10-02 16:08:01 +00:00
Alexander Kabaev
c5672dd7b9 Convert pnmatch to single element array in regexec calls
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
2019-10-02 06:15:30 +00:00
Pedro F. Giffuni
8a16b7a18f 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.
2017-11-20 19:49:47 +00:00
Warner Losh
fbbd9655e5 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
2017-02-28 23:42:47 +00:00
Eitan Adler
3ebd4af7e8 Change manual string conversion to expand_number
Reviewed by:	adrian
2013-11-09 08:57:21 +00:00
Eitan Adler
89c5c3aab8 Avoid signed overflow in error handling code.
Reviewed by:	cperciva, bjk
2013-05-21 19:56:03 +00:00
Eitan Adler
7f418e3407 Implement 'split -d' which allows a numeric suffix instead of an
alphabetic one.

PR:		bin/116209
Submitted by:	Marcin Gryszkalis <mg@fork.pl> (adapted from)
Reviewed by:	will
MFC after:	1 week
2013-05-10 04:23:03 +00:00
Eitan Adler
af9eff1f20 Fix warning when compiling with gcc46:
error: variable 'defname' set but not use

Approved by:	dim
MFC after:	3 day
2012-01-10 02:55:43 +00:00
Ed Schouten
973aa6bc58 Add missing static keywords to split(1) 2011-11-06 08:17:11 +00:00
Joel Dahl
da52b4caaf 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
2010-12-11 08:32:16 +00:00
David Schultz
0e286f086c Add a -n option to split(1) to split files into N chunks rather than
having to specify the right number of bytes.

Obtained from:	NetBSD
Submitted by:	Jan Schaumann <jschauma@netmeister.org>
PR:		113175
2008-03-16 15:15:32 +00:00
Giorgos Keramidas
a6dd1c93f4 Add support for splitting at gigabyte boundaries. [1]
Also make both lowercase and uppercase suffix letters work
as byte-count suffixes, i.e. the following two commands are
equivalent now:

    % split -b 4m foo
    % split -b 4M foo

Submitted by:		Roman Divacky [1]
Lots of help by:	cperciva
Reviewed by:		cperciva
MFC after:		1 week
2006-08-10 10:41:47 +00:00
Giorgos Keramidas
49198c4297 Update usage & SYNOPSIS and clarify that input files are not removed.
Sort getopt option handling of -p too, while here.

The changes are adapted from a patch by Ruslan Ermilov, posted as
followup to docs/33852.

PR:             docs/33852
Submitted by:   Gary W. Swearingen <swear@blarg.net>
MFC after:      1 week
2006-08-08 21:25:22 +00:00
Tim J. Robbins
bb78dba49b Remove undocumented historic support for treating "-" as an option
instead of a file operand; this is not compatible with POSIX.
2005-08-30 12:32:18 +00:00
Tim J. Robbins
e93586df9d Remove the hack that varied the first character of the output file name
if none was specified on the command line. This is not permitted by
POSIX, and no longer needed now that we have the -a option.

PR:		85099
Submitted by:	Toby Peterson (Apple Computer)
2005-08-21 06:35:02 +00:00
Tim J. Robbins
0742d4ed1a Respect locale settings from the environment. 2004-07-11 14:44:23 +00:00
Tim J. Robbins
c81180b861 Support larger files (at least 64-bit offsets) by using off_t instead of
int to store offsets.
2002-07-15 05:31:55 +00:00
Juli Mallett
2c69ee9b45 Remove <sys/types> where we use <sys/param> already.
protoize.
2002-06-15 11:03:28 +00:00
Tim J. Robbins
3e4228c3be Allow "-" to be specified as an operand as well as an option.
SUSV3 requires something like "split -- -" to work. Document the "-" operand.
2002-05-27 05:27:10 +00:00
Tim J. Robbins
3f5869d0b0 Avoid overflowing `fname' if the file name prefix given on the command
line is too long.

Obtained from:	OpenBSD
2002-05-27 04:59:46 +00:00
Warner Losh
3f330d7d1a remove __P 2002-03-22 01:42:45 +00:00
Mike Barcroft
4185049582 Add -a option (SUSv3) to split(1).
Submitted by:	Tim J. Robbins <tim@robbins.dropbear.id.au>
MFC after:	1 month
2002-02-01 06:55:18 +00:00
Mark Murray
f1d37c20c0 WARNS=2 fixes, use __FBSDID, remove GCC-specific flags. 2001-12-12 23:09:07 +00:00
John W. De Boskey
aecbd99950 Add/fix the ability to split a file larger than 2 gigabytes.
Added $FreeBSD tag (in the way the already present sccsid is
done). I've been told the rcsid stuff may be of dubious value
so I'm curious to know if folks (still) use it.

Submitted by:	Brad Chisholm <blc@bsdwins.com>
2000-11-19 01:44:20 +00:00
Archie Cobbs
d37fcb98e3 Print usage via fprintf(stderr, ..) instead of errx() to avoid progname prefix.
Submitted by:	Philippe Charnier <charnier@xp11.frmug.org>
1999-02-05 00:42:14 +00:00
Archie Cobbs
2fa6610f1e Add new option '-p pattern' for splitting files based on matching lines in
the file with a regular expression. Useful for e.g. 'cvs diff' output.
Also compile cleanly with -Wall and fix a few style bugs.
PR:		bin/9405
1999-02-01 21:16:45 +00:00
Philippe Charnier
c002b33b60 Cosmetic in err() string. 1997-08-11 07:30:22 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Rodney W. Grimes
a3f8d23a48 This fixes 'split -l NNN foo'. As it stands split will
complain about an 'illegal line count' becuase it's looking
at the wrong end pointer (ep) to detect any extra characters
after the NNN.

Submitted by:	Rich Murphey <rich@freebsd.org>

This should probably get pulled into 2.0.6 and 2.1.0
1995-07-07 08:23:52 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00