Commit Graph

38 Commits

Author SHA1 Message Date
eadler
37e8ba211c cut: Fix out of boundary write on illegal list argument
It is possible to trigger an out of boundary write in cut if an invalid
range with autostart has been supplied.

PR:		227330
Submitted by:	tobias@stoeckmann.org
2018-05-23 09:16:20 +00:00
pfg
872b698bd4 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
imp
7e6cabd06e 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
andrew
fe5328de4d The is_delim function works on wchar_t characters not ints, update the
function to take a wchar_t as it's argument.

This fixes the build when wchar_t is not an int, i.e. ARM EABI.
2012-11-24 04:15:25 +00:00
eadler
1eb41dfcc4 Add 'w' flag to:
Use whitespace (spaces and tabs) as the delimiter.
Consecutive spaces and tabs count as one single field
separator.

Reviewed by:	swildner@dragonflybsd.org
Approved by:	cperciva
Obtained from:	DragonFlyBSD
MFC after:	1 week
2012-11-20 01:57:21 +00:00
kevlo
2c79397387 - Consistenly mention columns and fields
- Add -b to short error messages

Obtained from:	NetBSD
2012-06-11 03:02:40 +00:00
ed
91ffce3875 Add missing static keywords to cut(1) 2011-11-06 08:14:51 +00:00
joel
29af67e52c 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
tjr
0473e0491d When the last line of a file is missing a newline in -f mode, pass a
length argument to mbrtowc() that accounts for the terminating newline
character we add automatically. Failing to do this caused the loop to
unexpectedly run out of characters and incorrectly signal an "Illegal byte
sequence" error.
2004-11-05 10:45:23 +00:00
tjr
3318163536 Move some variable declarations to the top of the file. 2004-06-28 06:05:36 +00:00
tjr
46e11a46e2 Silence a warning about an unused argument. 2004-06-27 16:58:56 +00:00
tjr
d3e5b0992d Handle multibyte characters when cutting out fields (-f and -d options.) 2004-06-27 16:42:33 +00:00
tjr
02b0649fa8 Update a comment that compared the parser with an obsolete draft of
IEEE Std 1003.2-1992. Most of the "extensions" here were actually
required by the final version of the standard.
2004-06-27 15:27:15 +00:00
tjr
f3e5f1bddb Implement the -c option correctly in locales with multibyte characters
instead of treating it as a synonym for -b.
2004-06-27 14:55:07 +00:00
tjr
7c81a9a35e Make the handling of invalid multibyte sequences more robust by using
mbrlen() instead of mblen().
2004-06-27 10:35:28 +00:00
dwmalone
b4339b74ad ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by:	md5
2002-09-04 23:29:10 +00:00
jmallett
2b6e4e1504 Remove local prototypes for main(). 2002-08-19 03:07:56 +00:00
obrien
29b5b637c7 Consistently use FBSDID 2002-06-30 05:34:21 +00:00
tjr
3874025041 Don't split multibyte characters when the -n option is specified. 2002-06-08 07:27:21 +00:00
tjr
ef796a5f35 style(9): don't initialise variables in their declaration, remove space
after function name, use __unused on unused parameters instead of
initialising them to bogus values.
2002-06-07 09:13:43 +00:00
tjr
fb067c8f63 Initialise the `positions' array correctly before use. 2002-05-27 02:01:25 +00:00
tjr
2292a0fbef When a file name of "-" is given, read from standard input (SUSv3) 2002-05-24 09:56:18 +00:00
tjr
425cb2e9e1 Allow byte/character positions >_POSIX2_LINE_MAX to be specified by
dynamically growing the `positions' array.
2002-05-24 09:11:18 +00:00
tjr
631d66bee1 If processing of one file fails, try to process the remaining files and
exit non-zero instead of immediately exiting. The traditional BSD
behaviour is explicitly forbidden by P1003.2.
2002-05-24 06:03:12 +00:00
dd
b10afe2606 Silence the remaining warnings and clamp down with WARNS=2.
Not objected to by:	-audit
2001-06-07 02:57:58 +00:00
dd
3b8fad2c59 Teach cut(1) how to handle long lines: convert from fgets(3) to fgetln(3).
PR:		26810
Reviewed by:	dwmalone
2001-04-25 05:42:53 +00:00
charnier
aa6a70fb70 Remove duplicate FreeBSD Id
Remoce unused #include
Use imperative mode to start flag description
2001-02-06 20:03:48 +00:00
will
18f604377b De-__P()-ify
Reviewed by:	markm
2001-01-28 00:35:40 +00:00
will
bb6c08b6c4 BDECFLAGS: constify; use proper types. Add $FreeBSD$, clean up #ifndef lint.
Reviewed by:	markm
2001-01-28 00:34:29 +00:00
eivind
62b47b1e63 Merge from NetBSD: cut.1 rev 1.6 to 1.8
cut.c rev 1.9 to 1.13
* Man page internal cleanups
* 8-bit characters cast to unsigned for is*()
* Misc cleanups for egcs -Wall compatibility
1999-02-02 15:48:04 +00:00
eivind
eac18e1b61 Bring in use of strsep() to handle bad input better, and clean up
some text.

Obtained from:	Merge from OpenBSD
(cut.1 up to OpenBSD rev 1.3, cut.c up to OpenBSD rev 1.6)
1999-02-02 14:56:55 +00:00
eivind
040ae947ad Merge from NetBSD cut.1 rev 1.6 and cut.c rev 1.9, respectively. This
makes us conform to IEEE Std1003.2-1992 (``POSIX.2'').

Obtained from:	NetBSD (but with slight modifications).
1999-02-02 14:26:39 +00:00
archie
167c036e91 Tweaks to allow compiling -Wall (mostly adding "const" to char rcsid[]). 1998-12-06 22:58:23 +00:00
charnier
136480890d Use err(3) instead of local redefinition. Change argument name in man
page to sync with usage string.
1997-06-30 06:48:46 +00:00
imp
141381e1cb 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
peter
deba7db48c Merge from Lite2 1997-03-11 13:43:33 +00:00
ache
5955de08b0 Fix wrong separator output
Submitted by: julian
Obtained from: newsgroup?
1995-03-21 00:26:32 +00:00
rgrimes
f9ab90d9d6 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00