Commit Graph

25 Commits

Author SHA1 Message Date
FRIGN 31572c8b0e Clean up #includes 2015-02-14 21:12:23 +01:00
FRIGN a5ae899a48 Scrap readrune(), introducing fgetrune()
Interface as proposed by cls, but internally rewritten after a few
considerations.
The code is much shorter and to the point, aligning itself with other
standard functions. It should also be much faster, which is not bad.
2015-02-11 20:16:49 +01:00
FRIGN 471cf8f5bc Use runetypebody.h-functions in wc(1) 2015-02-11 15:48:18 +01:00
sin 39802832af wc: Make output POSIX compliant 2015-02-06 19:46:45 +00:00
sin 0c8fe5d19b wc: Report exit status properly 2015-02-06 19:11:33 +00:00
sin 5552db75ba Don't call var "read" 2015-02-01 10:22:11 +00:00
FRIGN 986a9de51a Add even stricter UTF-8-support to wc(1)
using readrune() and iswspace().
musl for instance doesn't differentiate between iswspace() and
isspace(), but when it does, the code will be ready.
It goes without saying that GNU coreutils don't use iswspace()[0].

[0]: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/wc.c
2015-02-01 04:06:06 +01:00
FRIGN 8ab096d2a4 Finish up wc(1)
Use size_t for all counts, fix the manpage and refactor the code.
Here's yet another place where GNU coreutils fail:

sbase:
$ echo "GNU/Turd sucks" | wc -cm
    15

coreutils:
$ echo "GNU/Turd sucks" | wc -cm
     15      15

Take a bloody guess which behaviour is correct[0].

[0]: http://pubs.opengroup.org/onlinepubs/009604499/utilities/wc.html
2015-02-01 03:01:11 +01:00
FRIGN ec8246bbc6 Un-boolify sbase
It actually makes the binaries smaller, the code easier to read
(gems like "val == true", "val == false" are gone) and actually
predictable in the sense of that we actually know what we're
working with (one bitwise operator was quite adventurous and
should now be fixed).

This is also more consistent with the other suckless projects
around which don't use boolean types.
2014-11-14 10:54:20 +00:00
FRIGN eee98ed3a4 Fix coding style
It was about damn time. Consistency is very important in such a
big codebase.
2014-11-13 18:08:43 +00:00
sin 0c5b7b9155 Stop using EXIT_{SUCCESS,FAILURE} 2014-10-02 23:46:59 +01:00
sin b744ad5216 If there's no newline we don't count the last word - fix it 2014-01-10 22:52:00 +00:00
sin b8edf3b4ee Add weprintf() and replace fprintf(stderr, ...) calls
There is still some programs left to be updated for this.

Many of these programs would stop on the first file that they
could not open.
2013-11-13 11:41:43 +00:00
sin f349dd5987 Use arg.h as much as possible and add usage() where missing
Rename eusage() to usage() as well.
2013-10-07 17:13:01 +01:00
sin c1730c78de Use int instead of char for getc() 2013-07-20 11:35:56 -04:00
David Galos 9f8deb4b23 Tar compiles on BSD, thanks Roberto E. Vargas Caballero. Also remove tons of trailing whitespace. 2013-07-20 01:27:42 -04:00
Federico G. Benavento 5c7b7e3fa8 s/getopt/ARGBEGIN/ wc 2013-03-10 21:12:10 -03:00
Connor Lane Smith 6be3e82218 add cksum 2011-06-10 04:14:05 +01:00
Connor Lane Smith ff97891dad add fold 2011-06-08 21:30:33 +01:00
Connor Lane Smith 0a3a8c55e4 ls cleanup 2011-05-27 23:56:43 +01:00
Connor Lane Smith 6ef3d9174b add ls; simpler pwd 2011-05-26 04:01:20 +01:00
Connor Lane Smith f458397d5a no, getopt.h is gnu specific 2011-05-24 18:58:36 +01:00
pancake da547fb294 add missing #include <getopt.h>
do not override CC in config.mk
2011-05-24 14:34:26 +02:00
Connor Lane Smith 9714d7b1d3 getopt 2011-05-24 01:13:34 +01:00
Connor Lane Smith 8e26716a5a initial commit 2011-05-23 02:36:34 +01:00