Commit Graph

230 Commits

Author SHA1 Message Date
FRIGN
e7c33c4af3 Audit basename(1)
1) be stricter which number of arguments is accepted (1 or 2)
2) basename already returns a pointer to "." is argv[0] is ""
3) No need to check for *p != '/', because basename() only returns
   a string beginning with '/' which has length 1, so if strlen(p)
   == 1, the only way for suffix to be "evaluated" is for off to
   be > 0, being equal to suffix being "", but "" != "/".
4) don't calculate strlen twice for each string. Store it in a
   ssize_t and check if it's > 0.
2015-02-28 14:48:44 +01:00
FRIGN
44bd931834 Add audit-section to README
Okay, so why another section?
The finished-section applies to general feature-completeness and
manual status. It somehow is not an indicator for general code-
clarity, so the audited-column reflects a thorough audit of the
underlying code and optimization.
Take a look at the upcoming basename(1)-patch for an example on
how this goes.
2015-02-28 14:42:26 +01:00
Evan Gates
5c8d5c1dca add time. do not mark complete/POSIX compliant as exit status is wrong. 2015-02-27 21:39:50 +00:00
Evan Gates
bf4c5d1fcd expr comments, cleanup, UTF-8 support 2015-02-26 17:26:47 +00:00
Quentin Rameau
7264acf7ed ls: add -n option 2015-02-22 12:30:47 +00:00
Tai Chi Minh Ralph Eastwood
0eaff8b7fe Update README for ls -R 2015-02-21 11:46:04 +00:00
sin
9c30fbf018 Add ls -A implementation
Thanks joshua@cubesolving.com!
2015-02-21 09:31:01 +00:00
Evan Gates
3751dd546f no need for libutf in test, a null byte is a null byte 2015-02-20 19:29:28 +00:00
sin
cd51795423 Implement nl -n format 2015-02-20 14:12:48 +00:00
sin
9de3546082 Implement nl -w width 2015-02-20 12:15:43 +00:00
sin
13e4231f4c Implement nl -v startnum 2015-02-20 12:05:54 +00:00
Evan Gates
76e6aacd60 Add initial find(1) implementation
No manpage yet.
2015-02-20 10:17:16 +00:00
Quentin Rameau
51b707e91e ls: add support for -p 2015-02-19 18:52:13 +00:00
FRIGN
b00a00703f Add proper d- and t-flag support to touch(1)
except the [,frac], [.frac] respectively, but that's ok.
2015-02-19 18:54:56 +01:00
sin
737e805505 touch -t is also unwanted 2015-02-19 15:28:05 +00:00
sin
32791d3ca7 Mark touch -d as unwanted in the README 2015-02-19 15:27:03 +00:00
Quentin Rameau
bf5f6a08a4 README: added options for date, ls, touch 2015-02-19 14:45:13 +00:00
sin
2137dfa334 Mark du(1) as finished in README 2015-02-18 20:43:46 +00:00
sin
14b95b5f53 Mark du -x as done in the README 2015-02-18 20:41:37 +00:00
sin
2a3f82a5cd Implement -u support for ls(1) 2015-02-18 16:29:46 +00:00
FRIGN
6b719faade Add q-flag to ls(1)
of course, UTF-8-aware. ;)
2015-02-17 18:59:01 +01: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
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
Tai Chi Minh Ralph Eastwood
7a5c4e3a29 Update README for chown, chgrp -H -L -P 2015-02-16 15:54:00 +00: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
sin
9f1f8d5dd8 Update uuencode manpage and mark as complete in README 2015-02-13 11:38:52 +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
FRIGN
93d0178852 uudecode(1) also needs the m-flag 2015-02-13 10:12:16 +01:00
FRIGN
066540b3c5 Update README with chgrp(1) and chown(1) status 2015-02-12 23:35:24 +01:00
sin
4888bae455 uniq: Add standards section to manpage and update README 2015-02-11 15:55:58 +00:00
sin
2e5a02dd26 uniq is now complete, update README 2015-02-11 15:27:19 +00:00
sin
5f06185b1b uniq: Fixup program usage and manpage
Remove -i as it is not required by POSIX.  We'll add it if we
hit scripts that require it.
2015-02-11 12:19:38 +00:00
sin
a29d31e94b Update readlink in README 2015-02-11 11:54:58 +00:00
sin
aed987a9af Update README 2015-02-11 10:57:00 +00:00
FRIGN
1c6298103e Fix alphabetical order in README 2015-02-10 12:11:21 +01:00
Evan Gates
bc07f1b9b5 Add initial implementation of sed(1)
No manpage yet.
2015-02-10 10:35:22 +00:00
FRIGN
7143737b50 Update README reflecting recent changes to the codebase 2015-02-10 00:53:48 +01:00
FRIGN
360a63769c Use strtonum and libutf in test(1), refactor code and manpage
and mark it as finished in README.
2015-02-09 22:21:23 +01:00
FRIGN
006c9739b3 Add c-flag to tail(1) and refactor manpage
and mark it as finished in README.
2015-02-09 18:38:41 +01:00
FRIGN
a5cc60f2e0 Refactor tail(1) manpage and update README
It's not finished yet. We still need the c-flag.
2015-02-09 16:26:17 +01:00
FRIGN
d6b3890af6 Add r-flag to touch(1), refactor manpage and code
and mark it as finished in README.
2015-02-09 00:41:57 +01:00
FRIGN
49ed53b46c Reformat README 2015-02-09 00:20:33 +01:00
FRIGN
5699d5fb64 Refactor tar(1) manpage
and mark it as finished in the README.
Specifically, add a small section on the compression flags, which
are basically an infected GNU limb which should be removed from
the face of the earth as soon as possible.
2015-02-08 23:16:27 +01:00
FRIGN
1df65f4af4 Refactor sponge(1) code and manpage
and mark it as finished in README.
2015-02-08 22:17:21 +01:00
FRIGN
3e7c549862 Refactor sync(1) code and manpage
and mark it as finished in README.
2015-02-08 22:08:14 +01:00
FRIGN
e01469c9a2 Refactor unlink(1) code and manpage
Remove superfluous stdlib.h-include.
2015-02-08 21:59:59 +01:00
FRIGN
1513c2b766 Refactor unexpand(1) code and manpage, adding tablist support
as already seen for expand(1), only twice as complicated.
2015-02-08 21:24:22 +01:00
FRIGN
28b4b25076 Refactor uname(1) code and manpage
remove stdlib.h-include which was there for no reason and clear
up the manpage.
2015-02-07 22:15:56 +01:00
FRIGN
018d60c6bf Refactor tty(1) code and manpage 2015-02-07 22:00:28 +01:00
FRIGN
79e45395e5 Refactor cmp(1) code and manpage
The algorithm had some areas which had potential for improvement.
This should make cmp(1) faster.
There have been changes to behaviour as well:

1) If argv[0] and argv[1] are the same, cmp(1) returns Same.
2) POSIX specifies the format of the difference-message to be:
      "%s %s differ: char %d, line %d\n", file1, file2,
      <byte number>, <line number>
   However, as cmp(1) operates on bytes, not characters, I changed
   it to
      "%s %s differ: byte %d, line %d\n", file1, file2,
      <byte number>, <line number>
   This is one example where the standard just keeps the old format
   for backwards-compatibility. As this is harmful, this change
   makes sense in the sense of consistentcy (and because we take
   the difference of char and byte very seriously in sbase, as
   opposed to GNU coreutils).

The manpage has been annotated, reflecting the second change, and
sections shortened where possible.
Thus I marked cmp(1) as finished in README.
2015-02-07 21:05:33 +01:00
Hiltjo Posthuma
949f930280 split: fixes
- -b argument required, don't allow -b <= 0.
- -l argument required, don't allow -l <= 0.
- usage() and argument parsing: sort flags.
- don't write 0 size file, get rid of goto reproducable with:
  printf 'a' | split -b 1.
- close FILE *in if != stdin.
- mark split as finished in README.
- codestyle fixes.
2015-02-01 16:30:12 +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
sin
d75cc2e556 POSIX doesn't specify yes(1) so mark it as such in README 2015-02-01 01:27:44 +00:00
FRIGN
f40608ef09 Finish up yes(1) by adding multiple string support 2015-02-01 02:13:47 +01:00
FRIGN
5a20d0e9d7 Finish up cols(1) 2015-02-01 00:55:22 +01:00
FRIGN
7cdb24d085 Finish up setsid(1) 2015-02-01 00:47:32 +01:00
FRIGN
7faf732d0b Edit readlink.1 and document missing flags 2015-02-01 00:43:43 +01:00
FRIGN
a645f52843 Finish up printenv(1) 2015-02-01 00:23:38 +01:00
FRIGN
93a0e759c9 Finish up mktemp(1) 2015-02-01 00:14:19 +01:00
FRIGN
01195fa7e5 Finish up hostname(1) 2015-02-01 00:03:03 +01:00
FRIGN
bcf264f9cd Finish up chroot(1) and md5sum(1) 2015-01-31 23:54:51 +01:00
FRIGN
329936053b Add mandoc-manpage for sleep(1) and refactor the code a bit
and mark it as finished in README.
2015-01-30 13:41:36 +01:00
FRIGN
dc7f392339 Add mandoc-manpage for rmdir(1)
and mark it as finished in README.
2015-01-30 13:30:03 +01:00
FRIGN
97ad252d5d Add mandoc-manpage for rm(1)
and mark it as finished in README.
2015-01-30 11:34:05 +01:00
FRIGN
0d32a8963f Mark renice(1) as finished in README 2015-01-29 23:58:44 +01:00
FRIGN
d4e2067d3d Add mandoc-manpage for paste(1)
and mark it as finished in README.
2015-01-29 21:26:09 +01:00
FRIGN
cdbc0d5035 Add UTF8-support to paste(1) and refactor parallel()
Hopefully it now is clearer what the heck is going on.
2015-01-29 20:15:50 +01:00
FRIGN
7b6d918b78 Add mandoc-manpage for nohup(1)
and mark it as finished in README.
2015-01-28 23:55:57 +01:00
FRIGN
20b5d7c0d4 Add mandoc-manpage for nice(1)
and mark it as finished in README.
2015-01-28 22:40:40 +01:00
FRIGN
7437901098 Add mandoc-manpage for mv(1)
and mark it as finished in README.
Make it clear that -i has not been implemented yet and drop the
flag in the code instead of erroring out.
2015-01-28 22:06:50 +01:00
FRIGN
befec8cf67 Add mandoc-manpage for mkfifo(1) and add full mode support
and mark it as finished in the README.

Previously, it would only parse octal mode strings. Given
we have the parsemode()-function in util.h anyway, why not
also use it?
2015-01-28 20:55:50 +01:00
FRIGN
58dac5cf0a Add mandoc-manpage for mkdir(1) and clean up code
and mark it as finished in the README.
2015-01-26 15:30:56 +01:00
FRIGN
1d28e5b981 Add mandoc-manpage for logname(1)
and mark it as finished in README.
2015-01-26 15:06:50 +01:00
FRIGN
00e7f4e38a Add mandoc-manpage for ln(1)
and mark it as finished in the README.
2015-01-26 14:54:22 +01:00
FRIGN
7067089798 Fix alphabetical order in README 2015-01-26 13:12:44 +01:00
FRIGN
0bb5f5f453 Add mandoc-manpage for link(1)
and mark it as finished in the README.
2015-01-25 22:44:47 +01:00
FRIGN
741d8c9a76 Add mandoc-manpage for head(1) and clean up code
and mark it as finished in the README.
2015-01-25 22:01:26 +01:00
FRIGN
d6bcbf521b Mark fold(1) and grep(1) as finished in the README 2015-01-25 21:33:28 +01:00
FRIGN
b98bf41ecc Add mandoc-manpage for expr(1)
and mark it as finished in README.
Upon further checking, expr(1) turns out to be implicitly UTF-8 compliant.
2015-01-25 16:49:46 +01:00
FRIGN
692c11bf2b Add tablist support and a mandoc-manpage to expand(1)
and mark it as finished in the README.

This is another example showing how broken the GNU coreutils are:

$ echo -e "äää\tüüü\tööö" | gnu-expand -t "5,10,20"
äää    üüü    ööö
$ echo -e "äää\tüüü\tööö" | sbase-expand -t "5,10,20"
äää  üüü  ööö

This is due to the fact that they are still not UTF8-aware and
actually see "ä" as two single characters, expanding the "äää" with
4 spaces to a tab of length 10.
The correct way however is to expand the "äää" with 2 spaces to a
tab of length 5.
One can only imagine how this silently breaks a lot of code around
the world.
WHAT WERE THEY THINKING?
2015-01-25 14:31:02 +01:00
sin
6ba882ec39 We don't need GNU make to build on OpenBSD 2015-01-24 12:30:20 +00:00
FRIGN
616379f8ca Add mandoc-manpage for env(1)
and mark it as finished in the README.
2015-01-24 00:22:06 +01:00
FRIGN
22c6502b67 Add mandoc-manpage for echo(1)
and mark it as finished in the README.
2015-01-23 23:49:24 +01:00
FRIGN
8ac1165125 Mark insane POSIX flags
which we are not planning to include into sbase.
What's left to discuss is how we're going to handle them in the
tools (dump usage() or silently ignore them).
2015-01-23 23:31:46 +01:00
FRIGN
ac208e23ca Add mandoc-manpage for dirname(1)
and mark it as finished in the README.
2015-01-23 23:17:54 +01:00
FRIGN
743707a7b4 Mark non-UTF8-tools as non-finished
This makes clearer that these tools might require some more work.
2015-01-23 23:00:20 +01:00
FRIGN
c208c6328a Add mandoc-manpage for date(1) and clean up code
and mark it as finished in README.
2015-01-23 22:54:25 +01:00
FRIGN
b53469bc67 Mark tee(1) as finished in the README 2015-01-23 22:04:19 +01:00
FRIGN
0489895bb5 Add mandoc-manpage for tee(1)
and mark it as done in the README,
as the -i-flag has been added previously.
2015-01-23 22:02:45 +01:00
FRIGN
733b33f1c7 Add UTF-8-delimiter-support to cut(1)
Now you can specify a multibyte-delimiter to cut, which should
definitely be possible for the end-user (Fuck POSIX).
Looking at GNU/coreutils' cut(1)[0], which basically ignores the difference
between characters and bytes, the -n-option and which is bloated as hell,
one has to wonder why they are still default. This is insane!
Things like this personally keep me motivated to make sbase better
every day.

[0]: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/cut.c;hb=HEAD
     NSFW! You have been warned.
2015-01-22 12:32:50 +01:00
sin
dc70eb7976 ls: Implement -c and update manpage
Update usage + README as well.  Apparently some of the options (
-H and -L) had already been implemented but not reflected in the
program usage line.
2015-01-20 16:50:37 +00:00
sin
b1f750d96e Update README for touch 2015-01-20 11:22:09 +00:00
FRIGN
8b623f8593 Also indent the headings 2015-01-18 19:41:14 +01:00
FRIGN
07cfc6ee42 Add column to mark UTF-8 support
One major milestone is to have the sbase-tools supporting UTF-8.
Tools like cut(1) with the -n flag don't make sense otherwise.
And while the gnu coreutils cut(1) blatantly ignores such an
important aspect, we will not tolerate this madness and mark it
as a TODO in the main README.
Since most tools inherently support UTF-8 anyway, this just concerns
tools which mangle with text or search in it in special ways.
2015-01-18 19:36:13 +01:00
FRIGN
76ca226e81 Add mandoc-manpage for cut(1) and clean up code
and mark it as finished in README.
2015-01-18 11:30:31 +01:00
FRIGN
f9a1e11661 Add mandoc-manpage for comm(1) and clean up code
and mark it as finished in README.
2015-01-17 23:10:07 +00:00
FRIGN
43b8fa1a58 Add mandoc-manpage for cksum(1) and clean up code
and mark it as done in README.
2015-01-17 23:09:41 +00:00
FRIGN
b55de3d1a2 Add mandoc-manpage for chmod(1)
and mark it as finished in README.

One small rationale on the way the manpage is set up: Looking at
the coreutils manpage, it does not invite to be a quick reference
guide, whereas I wrote this manpage to be short and concise in regard
to the information the advanced user needs.
No one needs to explain what an octal number is. That's not part of
the scope of this manpage.
Also, nobody wants to read a block of text just to find out how
to build an octal mode string.
2015-01-17 21:59:37 +00:00
FRIGN
b375bc99bd Mark cal(1) as finished in README 2015-01-16 21:22:24 +00:00
Greg Reagle
6c2074560e Use the Julian/Gregorian calendar
Use the Julian calendar for dates through September 2, 1752 and
the Gregorian calendar for dates from September 14, 1752.
2015-01-16 10:03:18 +00:00
FRIGN
7a58d65483 Add mandoc-manpage for cat(1)
and mark it as finished in the README.
2015-01-16 10:03:18 +00:00
FRIGN
f196a7dfd9 Add manpages for false(1) and true(1)
and mark them as finished in the README.
2015-01-16 10:03:18 +00:00
FRIGN
33e2df5206 Add mandoc-manpage for tr(1)
and mark it as finished in the README.
2015-01-16 10:03:18 +00:00
FRIGN
bab75bfe58 Amend list of tools with asterisks
to mark tools considered finished.

Finished doesn't mean work has stopped on these, but that these
programs are in a satisfying state according to the current suckless
coding practices, this includes having a

 1) mandoc manpage
 2) clean code

In most cases, 1) was the failing criterion. So in the interest of
finishing more tools and if you want to, well-written mandoc man-
pages are very much appreciated.
2015-01-15 22:22:17 +00:00
FRIGN
2447dad2fb Add tool status in README
This will make it easier to identify things that need more work.
2015-01-15 20:40:49 +00:00
sin
e296329773 Rename crond to cron 2014-12-16 11:04:07 +00:00
sin
669f4b45cd Add crond(1) to README 2014-12-09 16:22:10 +00:00
sin
c953c022d3 Remove section on minix in README
All tools currently compile except ln(1) which uses the *at()
that do not seem to be implemented.
2014-12-08 14:55:25 +00:00
sin
95c9b4b255 Staticise functions in logger(1) 2014-12-04 11:46:11 +00:00
sin
5d1e46fefa Implement POSIX 2008 compliant logger(1) 2014-12-04 11:36:40 +00:00
sin
228e8c4a0b Update note on building sbase on OpenBSD 2014-11-21 10:36:59 +00:00
sin
159cc298c4 Add an easier to edit "table" of tools in README
We need to go through the tools and update this table to reflect
current state.
2014-11-20 23:06:39 +00:00
sin
0d7c2351b4 Remove csplit(1)
Get rid of it for now as it is not really widely used.  We can do
a simple implementation when time comes.

Remove the table from README because it is not easy to edit unless
you use emacs.
2014-11-20 13:52:18 +00:00
sin
74ac827587 Require GNU make to build sbase
We seem to have problems building individual tools across various
make implementations.  If anyone can step up and fix this we will
remove the dependency on GNU make.
2014-11-17 13:54:24 +00:00
sin
dfd0e6e77d Add a conformance table in the README
We should investigate the current state of the tools one by one
and mark out those that are complete and POSIX conformant.
2014-11-13 14:59:41 +00:00
sin
d364a813be Remove misleading line in README
We try to follow POSIX as much as possible.
2014-10-19 13:20:51 +01:00
Brandon Mulcahy
7a73da6864 Add logname(1) 2014-10-17 15:36:27 +01:00
Markus Teich
314885836c Add link(1) 2014-10-17 15:36:16 +01:00
sin
1dd2913e33 Update list of tools in README 2014-10-16 12:34:24 +01:00
sin
7305786244 Add col(1) to README 2014-09-29 19:53:02 +01:00
sin
618aecd2ec Import expr(1) from OpenBSD
Cleanup + manpage to be done.
2014-09-29 13:44:49 +01:00
sin
015cecfd8d Update README for printf(1) and remove from TODO 2014-09-28 15:13:09 +01:00
sin
a9c9681f95 Fixup README
This is now consistent with ubase.  The advantage is that it can
be generated very easily with:

for i in $(./sbase-box); do echo $i; done
2014-07-26 15:46:33 +01:00
Tuukka Kataja
8b87d0098a Add unexpand(1) 2014-06-09 17:00:13 +01:00
sin
99300c9514 Update README
sbase compiles on minix3 as well.
2014-02-27 16:56:59 +00:00
sin
5c6a17ef20 Remove who(1) from README 2014-02-14 15:09:55 +00:00
sin
a79472bb1a Minor fix for README 2014-02-12 18:39:31 +00:00
sin
f8dd426745 Add initial README 2014-02-12 14:36:00 +00:00