Commit Graph

1624 Commits

Author SHA1 Message Date
FRIGN
4391984115 Use e-functions in sed(1)
and take off the tin-foil-head by removing checks for printf-return-
values.
2015-02-18 11:21:56 +01:00
FRIGN
a98405d277 Refactor sed(1) a bit
Well, isspacerune() has been fixed and some other FIXME's were also easy
to do.
There are some places where maybe some util-functions could be helpful.
In some cases, like for instance in regard to escape-sequences, I'm all
for consistency rather than adhering to the POSIX-standard too much.
Relying on centralized util-functions also makes it possible to keep
this consistency across the board.
2015-02-18 10:51:39 +01:00
FRIGN
6b719faade Add q-flag to ls(1)
of course, UTF-8-aware. ;)
2015-02-17 18:59:01 +01:00
FRIGN
ef23f966c5 Refactor strings(1) loop again
fixing a little out-of-bounds write.
2015-02-17 18:18:54 +01:00
FRIGN
439bf8a157 Fix small issue in strings(1) loop
It wouldn't print the len'th character.
2015-02-17 18:11:59 +01:00
sin
aa6ac30b81 chown: Update program usage and manpage 2015-02-17 16:41:58 +00:00
sin
16719ea6e1 cp: Update program usage and manpages
Do not document the non-standard -r flag as it is highly discouraged.
It is still silently accepted and treated the same as -R.
2015-02-17 16:14:42 +00:00
sin
6c31f1d2a8 du: Update usage and document -P as well 2015-02-17 16:14:31 +00:00
FRIGN
e5b5497773 Add UTF-8-support to strings(1), add t-flag and refactor code
Previously, the string-length was limited to BUFSIZ, which is an
obvious deficiency.
Now the buffer only needs to be as long as the user specifies the
minimal string length.
I added UTF-8-support, because that's how POSIX wants it and there
are cases where you need this. It doesn't add ELF-barf compared to
the previous implementation.
The t-flag is also pretty important for POSIX-compliance, so I added
it.
The only trouble previously was the a-flag, but given that POSIX
leaves undefined what the a-flag actually does, we set it as default
and don't care about parsing ELF-headers, which has already
turned out to be a security issue in GNU coreutils[0].

[0]: http://lcamtuf.blogspot.ro/2014/10/psa-dont-run-strings-on-untrusted-files.html
2015-02-17 17:04:36 +01:00
sin
949dafc171 strings: The default minimum length sequence is 4 characters not 6 2015-02-17 13:55:44 +00:00
sin
4904f26e5d strings: Remember to include limits.h for INT_MAX 2015-02-17 13:50:10 +00:00
sin
d8a89002d3 strings: Add -n len support 2015-02-17 13:46:48 +00:00
sin
8ce6d7091a strings: Default to -a 2015-02-17 13:40:36 +00:00
sin
9effb224c8 expand, unexpand: Minor style fix as per the suckless guide 2015-02-17 12:14:44 +00:00
sin
29be7a3f23 tar: Style fix 2015-02-17 09:13:15 +00:00
FRIGN
e77f0b0b9f Simplify sha*sum.c 2015-02-17 10:08:28 +01:00
FRIGN
8e016fad91 Make the tar(1)-header fixed again
This is clearer.
2015-02-16 20:01:33 +01:00
FRIGN
eb17f2cc9c Refactor tar(1) 2015-02-16 19:47:36 +01:00
FRIGN
bec3c32dbd Refactor ls(1) 2015-02-16 19:20:06 +01:00
sin
9da1deaab9 chmod: Add -HLP flags and update manpage 2015-02-16 16:47:07 +00:00
sin
1d05b293e1 chgrp: Update program usage and manpage
-h is incompatible with -R so handle that properly as well.
2015-02-16 16:33:39 +00:00
sin
8f068589fb Fix recurse() prototype and convert char to int flags 2015-02-16 16:23:12 +00:00
sin
d8fa891008 Remove redundant definition of argv0 2015-02-16 16:12:36 +00:00
Tai Chi Minh Ralph Eastwood
7a5c4e3a29 Update README for chown, chgrp -H -L -P 2015-02-16 15:54:00 +00:00
Tai Chi Minh Ralph Eastwood
0cf6a18f6f recurse: change char follow to int follow 2015-02-16 15:53:58 +00:00
Tai Chi Minh Ralph Eastwood
82bc92da51 recurse: add symlink derefencing flags -H and -L 2015-02-16 15:53:55 +00:00
FRIGN
5a13865385 Fix \c behaviour
The loop magic broke along the way. Just drop that and write a
proper early exit (= termination).
Now it should work as expected.
2015-02-16 10:31:13 +01:00
Tai Chi Minh Ralph Eastwood
26168d5c37 uudecode: fix error msgs (newlines, no output name) 2015-02-15 19:37:17 +00:00
sin
92b14e9c77 Use BSD style function definitions 2015-02-15 16:00:32 +00:00
FRIGN
9418101293 Fix isprintrune()'s behaviour
I somehow missed this issue. A rune can not be smaller than the left
range-delimiter and bigger than the right range-delimiter at the
same time.
The real check has to check if either condition applies.
2015-02-15 16:27:45 +01:00
FRIGN
dc3a2ffc4a Handle empty format string in printf(1) 2015-02-15 15:20:32 +01:00
FRIGN
5c8a9b375f Update escape-sequence information in tr.1 2015-02-15 14:56:49 +01:00
FRIGN
bafd41e1cf Add printf(1)
This is a particularly interesting program.
I managed to implement everything according to POSIX except how
octal escapes are specified in the standard, which is yet another
format compared to the one demanded for tr(1).
This not only confuses people, it also adds unnecessary cruft
for no real gain.
So in order to be able to use unescape() easily and for consistency,
I used our initial format \o[oo] instead of \0[ooo].

Marked as optional is UTF-8 support for %c in the POSIX specification.
Given how well-developed libutf has become, doing this here was more
or less trivial, putting us yet again ahead of the competition.
2015-02-15 14:46:58 +01:00
FRIGN
d7a438b2f8 Add \e, \", \' and hex-escapes (\xH[H]) to unescape()
So the users control the program, and the program doesn't
control the users.
2015-02-14 22:55:37 +01:00
FRIGN
bf518929b9 Remove runetype and to*rune section from TODO 2015-02-14 21:56:19 +01:00
sin
3e1e54051e Add some missing includes 2015-02-14 20:15:01 +00:00
FRIGN
31572c8b0e Clean up #includes 2015-02-14 21:12:23 +01:00
sin
71fb259d02 Remove evil and unused assert.h from cols(1) 2015-02-14 18:26:45 +00:00
sin
d4830dba30 Fix fgetrune on systems where char is unsigned by default (ARM)
Store the result in an int and do the comparison.  This is always
safe without using strange constructs like "signed char".

wc(1) would go into an infinite loop when executed on an ARM
system.
2015-02-13 15:42:54 +00:00
sin
9f1f8d5dd8 Update uuencode manpage and mark as complete in README 2015-02-13 11:38:52 +00:00
sin
f7b100ecdd Fix section order in uudecode.1 2015-02-13 11:37:17 +00:00
sin
bf4a39bb8c Clarify that -m is an extension to the POSIX specification for uudecode 2015-02-13 11:32:54 +00:00
sin
e8cd6947ec Update uudecode manpage and mark as complete 2015-02-13 11:30:55 +00:00
sin
c4e951366f Update README for uudecode and uuencode 2015-02-13 11:21:52 +00:00
sin
7768918d6a uudecode: Style fix 2015-02-13 11:20:23 +00:00
sin
d61add5dee uuencode: Style fix 2015-02-13 11:20:22 +00:00
Tai Chi Minh Ralph Eastwood
b64b51dc91 uudecode: fix flushing (again) through rewrite 2015-02-13 11:20:22 +00:00
Tai Chi Minh Ralph Eastwood
b907e8747d uuencode: refactor by removing extranous #include 2015-02-13 11:20:22 +00:00
Tai Chi Minh Ralph Eastwood
6d2cbf7a3f uudecode: fix flushing in corner case 2015-02-13 11:20:21 +00:00
Tai Chi Minh Ralph Eastwood
ec02816d3e uuencode: add support for base64 and -o to stdout 2015-02-13 11:20:21 +00:00