Commit Graph

1024 Commits

Author SHA1 Message Date
sin
a2dd0d3950 Make cal(1) more readable 2015-01-18 00:40:37 +00: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
572cea058c 2014 -> 2015 in cksum.1 2015-01-17 23:09:45 +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
eff58b5531 Refactor chmod(1)
Clean the mess.
2015-01-16 23:08:36 +00:00
FRIGN
40bbe91c9e Fix a small error in cal(1) manpage
The current implementation doesn't implement the day-variable.
2015-01-16 21:48:50 +00:00
FRIGN
b375bc99bd Mark cal(1) as finished in README 2015-01-16 21:22:24 +00:00
FRIGN
f8177c8ca4 cal(1) cleanup
According to suckless coding guidelines.
2015-01-16 21:22:24 +00:00
FRIGN
bdca40494a Add mandoc-manpage for cal(1)
Grouping semi-exclusive flags makes it easier to understand what
you can do.
2015-01-16 21:22:23 +00:00
Greg Reagle
efac15726b If only the year operand is given, cal shall produce a calendar for all twelve months in the given calendar year. 2015-01-16 16:26:42 +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
3f0384e1ba Fix date 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
FRIGN
7d3e9c6e88 Resolve escape characters in tr(1)
This is one aspect which I think has blown up the complexity of many
tr-implementations around today.
Instead of complicating the set-theory-based parser itself (he should
still be relying on one rune per char, not multirunes), I added a
preprocessor, which basically scans the code for upcoming '\'s, reads
what he finds, substitutes the real character onto '\'s index and shifts
the entire following array so there are no "holes".

What is left to reflect on is what to do with octal sequences.
I have a local implementation here, which works fine, but imho,
given tr is already so focused on UTF-8, we might as well ignore
POSIX at this point and rather implement the unicode UTF-8 code points,
which are way more contemporary and future-proof.

Reading in \uC3A4 as a an array of 0xC3 and 0xA4 is not the issue,
but I'm still struggling to find a way to turn it into a well-formed
byte sequence. Hit me with a mail if you have a simple solution for
that.
2015-01-15 11:01:52 +00:00
FRIGN
7a644aea7d Fix mapping a class to a simple set and improve error-reporting
It's standard behaviour to map a whole class of matched objects
to the last element of a given simple set2 instead of just passing
it through.
Also, error out more strictly when the user gives us bogus sets.
2015-01-12 11:19:43 +00:00
FRIGN
0f90528df7 Add proper casts and fix a small error 2015-01-11 22:35:15 +00:00
FRIGN
09704afc24 Add Unicode character class support
Thinking about it long enough, the solution seems almost trivial.
2015-01-11 22:35:15 +00:00
FRIGN
369bb01eb1 Prevail order 2015-01-10 19:56:34 +00:00
Hiltjo Posthuma
14c5ab48d5 tr: set2 must be set in some cases
echo abc | tr 'a' '' would crash because of:

	m--;
	r = set2[m].start + (off1 - off2) / set2[m].quant;

if set2ranges > 0 it's fine.
2015-01-10 18:16:43 +00:00
Hiltjo Posthuma
4469b0b641 chartorunearr: initialize ret 2015-01-10 17:00:01 +00:00
Hiltjo Posthuma
cf714e6edb tr: fix signed/unsigned warnings 2015-01-10 17:00:01 +00:00
sin
1f3345b9e6 Staticise some symbols in tr(1) 2015-01-10 14:26:32 +00:00
FRIGN
a582cb8a2f Rewrite tr(1) in a sane way
tr(1) always used to be a saddening part of sbase, which was
inherently broken and crufted.
But to be fair, the POSIX-standard doesn't make it very simple.
Given the current version was unfixable and broken by design, I
sat down and rewrote tr(1) very close to the concept of set theory
and the POSIX-standard with a few exceptions:

 - UTF-8: not allowed in POSIX, but in my opinion a must. This
          finally allows you to work with UTF-8 streams without
          problems or unexpected behaviour.
 - Equivalence classes: Left out, even GNU coreutils ignore them
                        and depending on LC_COLLATE, which sucks.
 - Character classes: No experiments or environment-variable-trickery.
                      Just plain definitions derived from the POSIX-
                      standard, working as expected.

I tested this thoroughly, but expect problems to show up in some
way given the wide range of input this program has to handle.
The only thing left on the TODO is to add support for literal
expressions ('\n', '\t', '\001', ...) and probably rethinking
the way [_*n] is unnecessarily restricted to string2.
2015-01-10 14:26:30 +00:00
Greg Reagle
83616df6fc cal: Removed unused "day" variable 2015-01-07 03:21:12 +00:00
Greg Reagle
c6f1e8aa20 Various cal(1) improvements
1) No limit on number of months (removed MONTHMAX)
2) Strings printed to stdout rather than copied to an internal buffer
3) Rewritten date calculation algorithms
2015-01-02 13:14:41 +00:00
sin
6faeb36e14 Update LICENSE 2014-12-31 22:02:07 +00:00
sin
5467beec34 Add Adria to LICENSE 2014-12-23 18:09:23 +00:00
sin
58d64d5298 Add Brandon to LICENSE 2014-12-23 18:04:07 +00:00
sin
4af15bae9f Update LICENSE to have a separate section for authors/contributors
The list is getting too long.  Leave the maintainers at the top
and add a section of authors/contributors below the license statement.

Helps maintain the license at the top of the file.
2014-12-23 17:59:53 +00:00
sin
bb59d2eb34 ls: No need to set errno to zero
Consider the following code:

pw = getpwuid(uid);
if (!pw) {
	if (errno)
		...
	else
		...
}

If the entry was not found then as per POSIX errno is not set
because that is not considered to be a failing condition.  errno
is only set if an internal error occurred.

If errno happened to be non-zero before the getpwuid() call
because of a previous error then we'll report a bogus error.

In this case, we have to set errno to zero before the call to
getpwuid().

However in ls(1) we only really care if the password entry was found
and we do not report any errors so setting errno to 0 is not necessary.
2014-12-22 11:28:20 +00:00
Hiltjo Posthuma
32651cb2da ls: getpwuid, getgrgid, use return code of NULL is an error, not errno 2014-12-22 11:28:20 +00:00
Hiltjo Posthuma
3d8d796a95 unexpand: fix eprintf 2014-12-22 10:34:29 +00:00
Hiltjo Posthuma
549669e657 du: fix eprintf parameter 2014-12-22 10:34:29 +00:00
sin
83e94e922e chgrp: Only check errno if getgrnam() fails 2014-12-21 12:14:26 +00:00
sin
09dad0083b Update TODO 2014-12-21 00:01:58 +00:00
Truls Becken
2433bb78cb cut: clean up file loop 2014-12-18 15:17:48 +00:00
sin
f08d798f77 tee: nuke useless free() 2014-12-16 21:12:00 +00:00
sin
153b8428b1 Nuke another freelist() 2014-12-16 21:02:03 +00:00
sin
fb85f99c0a grep: Reuse allocated buffers 2014-12-16 20:21:56 +00:00
sin
7e8fcc1f03 logger: Don't bother freeing buf
There are many more instances of this pattern.
2014-12-16 20:14:40 +00:00
sin
0d7822f866 Don't free the line buffer for each file
There's no point free-ing memory when the kernel can do it for us.
Just reuse the already allocated memory to hold lines.

Thanks Truls Becken for pointing this out.
2014-12-16 19:49:39 +00:00
sin
a3e4689743 grep: Don't bother free-ing the pattern list 2014-12-16 19:44:16 +00:00
sin
af66a5924e Add minimal cron.1 2014-12-16 11:04:18 +00:00
sin
e296329773 Rename crond to cron 2014-12-16 11:04:07 +00:00
Markus Wichmann
fea48eb229 Fix problem with multi month display spanning a year. 2014-12-16 10:56:13 +00:00