Commit Graph

29 Commits

Author SHA1 Message Date
wiz 97cd0ff474 From Igor Sobrado in private email (based on his OpenBSD commit):
improve POSIX compliance by continuing to process the remaining file
    operands after not finding an input file.

    from the IEEE Std 1003.1-2008 (``POSIX.1'') rationale:

    "Unlike other utilities, some historical implementations of cut
    exit after not finding an input file, rather than continuing to
    process the remaining file operands.  This behavior is prohibited
    by this volume of POSIX.1-2008, where only the exit status is
    affected by this problem."

    joint work with jmc@, who identified the compliance issue, and millert@

    ok millert@, jmc@
2014-02-03 20:22:19 +00:00
wiz 2414f9206a - remove trailing white space;
- synchronize argument name to `-d' in `usage' line with man page.

From Bug Hunting.
2012-06-20 17:53:39 +00:00
wiz 59a4ab1af9 Add -b to short error messages. Fix typo. From Bug Hunting in PR 44747. 2012-06-09 19:22:47 +00:00
wiz 9c98053fcd Sync usage with man page, from Bug Hunting. 2012-04-06 11:34:58 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
christos b3af16c2d3 PR/36583: Aleksey Cheusov: /usr/bin/cut: -[bcf] positions are limited to 2048
Fix provided by Anon Ymous.
2007-07-02 18:41:03 +00:00
hubertf 94c137d519 Teach 'cut -c' about multibyte characters. Fixes PR 34244,
using the patch from the PR and some hacking by myself to avoid code
redundancy.

Passes the regression tests I've added.

(How many weeks of purgatory do I get for the cpp(1) hack to avoid
 code redundancy? I guess I can always say it was inspired by some old
 version of our md5 sources...)
2007-02-17 19:10:00 +00:00
jnemeth a8488a76e0 PR/33995: Aleksey Cheusov: support use "-" to indicate stdin from SUS 2006-07-29 02:01:24 +00:00
christos 63b0d1ab71 Coverity CID 2790: Always free tmp buffer, not somethimes. 2006-04-25 19:34:42 +00:00
dsl 4c18b91e3e If fgetln() returns a buffer that isn't terminated by \n, free the temporary
buffer inside the loop.  Fixes coverty CID:1674.
(This should only happen at EOF, so the loop SHOULD terminate.)
While here always output a newline at the end of the input data even when
the last (unterminated) line doesn't contain a separator.
2006-03-30 19:17:44 +00:00
yamt 656cf52a10 a fix from openbsd.
XXX is it better to output a newline?

> revision 1.7
> date: 2000/06/04 23:52:19;  author: aaron;  state: Exp;  lines: +30 -14
> Handle the case where the last line of input does not contain a newline; issue
> reported by marc@snafu.org. The main thing here is we use fgetln() instead of
> fgets(), also giving us the advantage of being able to handle lines of
> unlimited length. Some -Wall and other fixes from millert@ as well.
2005-03-22 21:56:28 +00:00
xtraeme 6dca62f25b Kill __P(), use ANSI function declarations, constify; WARNS=3. 2005-02-17 17:35:47 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
itojun f51456c273 err/errx/warn/warnx do not need \n at the end 2002-06-11 06:06:18 +00:00
wiz 10f4f9ee80 Sync usage with man page synopsis. From Ryan Younce in bin/16644, with
slight changes.
2002-05-12 21:28:50 +00:00
christos c3203395bd char -> unsigned char 1998-11-06 23:06:38 +00:00
ross f670fa10c5 Add { and } to shut up egcs. Reformat the more questionable code. 1998-08-25 20:59:36 +00:00
lukem 263324f188 WARNSify, fix .Nm usage, getopt returns -1 not EOF, deprecate register 1997-10-18 13:21:28 +00:00
mrg 954a0f16a0 getopt returns -1 not EOF. 1997-02-11 09:41:45 +00:00
jtc 71bb6dda25 Sync with 4.4lite2 1995-09-02 05:57:23 +00:00
glass 843a1dd6bf Merged with 4.4Lite 1995-03-26 20:51:24 +00:00
mycroft 75cf3d0500 Better-looking patch for a problem already fixed. 1995-03-20 23:50:43 +00:00
jtc 105b403a51 Minor tweaks.
The most significant problem of not being able to handle text files with
infinately long lines (required by POSIX.2) has not been addressed.
1993-12-31 19:24:42 +00:00
jtc f7c6bf575a Minor tweaks: including header files to bring prototypes into scope,
explicitly declaring function return values, etc. to make gcc -Wall
shut up.
1993-08-27 22:30:10 +00:00
jtc 2ea901d347 Make cut 1003.2 compliant by adding -b and -n options. This was trivial,
as we don't support multibyte characters yet.
1993-08-16 22:44:50 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
cgd cbdd011637 Simon J. Gerraty <sjg@zen.void.oz.au>:
cut -f1 outputs a field separator before the first field.
1993-04-02 20:21:47 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00