summaryrefslogtreecommitdiffstats
path: root/usr.bin/wc/wc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-2/+2
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* For -w output in -m mode, tweak the handling of bytes that do notschwarze2018-09-301-2/+2
| | | | | | | | form valid UTF-8: treat them as "not a whitespace character" and hence "not a word boundary" in the same way as non-printable characters and NUL bytes. OK millert@
* fix the rest of the bug mitigated in the previous commit:schwarze2018-09-301-2/+3
| | | | | | do not embark on an infinite loop when -m is given and the file contains a NUL character; OK millert@
* Treat NUL like any other byte in the default case; aligns newline countcheloha2018-09-291-3/+4
| | | | | | | | with that of the '-l' case. From David Hines on bugs@. ok millert@
* Use <fcntl.h> instead of <sys/file.h> for open() and friends.guenther2018-04-261-2/+3
| | | | | | | Delete a bunch of unnecessary #includes and sort to match style(9) while doing the above cleanup. ok deraadt@ krw@
* - Removed unnecessary string.h includefcambus2016-09-161-24/+23
| | | | | | | | | | | | | | - Changed 'format_and_print' argument type to int64_t and casting inside the function - Declaring 'print_counts', 'format_and_print', and 'cnt' as static - Remove unnecessary cast for NULL, and (void) casts from printfs, 'mbtowc' and 'format_and_print' calls - In 'cnt', change bufsz type from ssize_t to size_t to avoid converting between pointers to integer types with different sign when calling getline (catched when compiling with Clang) - Use return instead of exit in main OK jung@
* UTF-8 support: implement -m for character countingschwarze2015-12-081-33/+66
| | | | | | | | | and use iswspace(3) for word counting. Requires using getline(3) rather than read(2) to make sure that characters aren't chopped to pieces. Using feedback from millert@ on an earlier version. Feedback and OK tedu@.
* Change all tame callers to namechange to pledge(2).deraadt2015-10-091-3/+3
|
* wc only opens files read-only, proceses them, and spits results to stdout.deraadt2015-10-031-1/+4
| | | | tame "stdio rpath" works, right before calling getopt()
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-4/+4
| | | | | | | | | possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
* remove erroneous char cast to switch expression processing getopt(3);okan2013-11-271-2/+2
| | | | | | not used in any cases. ok deraadt@, guenther@, millert@
* send a extra space to the bit bucketderaadt2013-11-231-2/+2
|
* simpler prototype repairsderaadt2013-11-121-1/+2
|
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-15/+1
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* do not print spurious whitespace when reading from stdin;otto2008-06-191-4/+7
| | | | from Bernd Ahlers with a twist from me; ok millert@
* Add -h option to display human-readable numbers.espie2005-10-191-9/+25
| | | | | | | okay otto@, deraadt@, jmc@. (note that is mostly useless from scripts, hence okay as a non-standard option).
* spacingderaadt2005-04-111-5/+5
|
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-031-7/+3
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* ansideraadt2002-09-171-12/+5
|
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-161-4/+4
|
* kill more registersmpech2001-11-191-7/+7
| | | | millert@ ok
* first pass at a -Wall cleanupderaadt2001-07-121-5/+5
|
* Remove useless cast to quad_t. Gcc thinks "%qd" in printf is the same as "%lld" so we get a warning on alpha with -Wall. Live with it.millert1999-02-021-5/+5
|
* o Some minor updates from lite2 (mostly in the man page)millert1999-02-021-60/+62
| | | | o Add support for large files by using quads as counters
* rcsidderaadt1996-06-261-1/+3
|
* initial import of NetBSD treederaadt1995-10-181-0/+258