Rob Landley
|
d3025b14b9
Convert utf8towc from wchar_t to unsigned (to match wctoutf8).
|
3 years ago |
Rob Landley
|
747e296ff6
Add FLAG(x) macro, expanding to (toys.optflags & FLAG_##x)
|
5 years ago |
Elliott Hughes
|
141a075c0e
Clean up some --help formatting.
|
5 years ago |
Elliott Hughes
|
d7c111f4c3
wc: fix the column width heuristics even further.
|
6 years ago |
Elliott Hughes
|
0bce1bdafb
Fix wc column widths.
|
6 years ago |
Rob Landley
|
b9613842c3
Replace remaining mb*towc() calls with utf8towc().
|
6 years ago |
Rob Landley
|
67ddade337
In wc, replace mbrtowc() with new utf8towc() which doesn't have a context struct
|
6 years ago |
Rob Landley
|
20f67f157c
Teach wc to do -cm together. Fix testsuite so TEST_HOST passes too.
|
8 years ago |
Elliott Hughes
|
09d9547776
Fix wc -c optimization.
|
8 years ago |
izabera
|
3684510034
make wc -c faster
|
8 years ago |
Rob Landley
|
d3a435e53c
Add error_msg_raw() and friends, replace error_msg("%s", s) uses, enable format
|
8 years ago |
Rob Landley
|
89a62bf290
When locale is enabled, sprintf("%.123s", str) is counting characters, not bytes, so we can't globally enable locale without opening stack/heap smashing vulnerabilities. Make commands individually request setlocale() using TOYFLAGS instead.
|
10 years ago |
Rob Landley
|
662a267c9b
Have error_msg() and friends set TT.exitval to 1 if it's still 0, clean out other places that were setting it that no longer need to.
|
11 years ago |
Rob Landley
|
55970d0c2c
Minor cleanup: unify two codepaths that do the same thing.
|
11 years ago |
Rob Landley
|
6e3876a5a6
Felix Janda pointed out that the r in mbrtowc() stands for "restartable" so it's already buffering the partial data we feed it, so rolling back most of the last commit to wc.
|
11 years ago |
Rob Landley
|
a9464f4153
The previous wc -m didn't handle multibyte characters that crossed a buffer boundary, so take a guess at making that work. (I haven't got a test case for this. I also don't know how to handle invalid sequences so just don't count them.)
|
11 years ago |
Rob Landley
|
6cf0a11545
Cleanup i18n support (#ifdefectomy, move global init to process launch). Teach make.sh to emit "#define FLAG_x 0" for options inside disabled USE macros so we can unconditionally refer to them.
|
11 years ago |
Felix Janda
|
250e0055fe
Make internalization support optional
|
11 years ago |
Rob Landley
|
7aa651a6a4
Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style.
|
11 years ago |
Felix Janda
|
abb8ca2455
wc -m only cares about counting characters. Attached is a try on implementing it and some test cases for it. The test cases are only for UTF-8 locales.
|
11 years ago |
Rob Landley
|
c0e56edaf2
New build infrastructure to generate FLAG_ macros and TT alias, #define FOR_commandname before #including toys.h to trigger it. Rename DEFINE_GLOBALS() to just GLOBALS() (because I could never remember if it was DECLARE_GLOBALS). Convert existing commands to use new infrastructure, and replace optflag constants with FLAG_ macros where appropriate.
|
11 years ago |
Rob Landley
|
7c8103e5d2
Posix compliance: wc shouldn't have trailing spaces (breaks aboriginal's mkinitr
|
12 years ago |
Rob Landley
|
3a9241add9
Move commands into "posix", "lsb", and "other" menus/directories.
|
12 years ago |