Commit Graph

17 Commits

Author SHA1 Message Date
FRIGN c25996924b Support NUL containing lines in join(1)
while also simplyfing the line-field-parser.
2016-03-10 08:48:09 +00:00
FRIGN 54d3f3b3a5 Rename linecmp and line-structs in join(1) and sort(1)
We will steal the names for the global functions.
2016-03-10 08:48:09 +00:00
FRIGN a88906b423 Rever the strmem() addition and add a TODO element
strmem() was not very well thought out. The thing is the following:
If the string contains a zero character, we want to match it, and not
stop right there in place.

The "real" solution is to use memmem() where needed and replace all
functions that assume zero-terminated-strings from standard input, which
could lead to early string-breakoffs.
This requires a strict tracking of string lengths.
2016-02-26 09:54:46 +00:00
FRIGN 3396088666 Implement strmem() and use it in join(1)
We want our delimiters to also contain 0 characters and have them
handled gracefully.
To accomplish this, I wrote a function strmem(), which looks for a
certain, arbitrarily long memory subset in a given string.
memmem() is a GNU extension and forces you to call strlen every time.
2016-02-26 09:54:46 +00:00
Quentin Rameau 6e7743eb56 Cleanup usage() across sbase
Some tools didn't use argv0 for tool name, or usage() at all.
2015-12-21 18:07:25 +00:00
sin e52845281a Fix warning in join(1)
Spotted by Random832.
2015-12-15 09:40:52 +00:00
sin 2366164de7 No need for semicolon after ARGEND
This is also the style used in Plan 9.
2015-11-01 10:18:55 +00:00
Wolfgang Corcoran-Mathe 625f421f5a join: Use LIMIT macro 2015-07-23 11:51:05 +01:00
Wolfgang Corcoran-Mathe 47c05f9ff4 join: Stricter parsing of -o list
This fixes naive parsing that would happily read a giant string
of numbers into fileno provided the first character was correct.
2015-06-25 12:11:23 +01:00
FRIGN a6f8f66ac1 Fix typo in join(1)
This was causing some mysterious output bugs.
Thanks, Wolfgang Corcoran-Mathe!
2015-06-07 09:09:42 +01:00
FRIGN d23cc72490 Simplify return & fshut() logic
Get rid of the !!()-constructs and use ret where available (or introduce it).

In some cases, there would be an "abort" on the first fshut-error, but we want
to close all files and report all warnings and then quit, not just the warning
for the first file.
2015-05-26 16:41:43 +01:00
FRIGN 9a074144c9 Remove handrolled strcmp()'s
Favor readability over bare-metal.
2015-05-21 15:43:38 +01:00
FRIGN 0545d32ce9 Handle '-' consistently
In general, POSIX does not define /dev/std{in, out, err} because it
does not want to depend on the dev-filesystem.
For utilities, it thus introduced the '-'-keyword to denote standard
input (and output in some cases) and the programs have to deal with
it accordingly.

Sadly, the design of many tools doesn't allow strict shell-redirections
and many scripts don't even use this feature when possible.

Thus, we made the decision to implement it consistently across all
tools where it makes sense (namely those which read files).

Along the way, I spotted some behavioural bugs in libutil/crypt.c and
others where it was forgotten to fshut the files after use.
2015-05-16 13:34:00 +01:00
Wolfgang Corcoran-Mathe 00883efc16 join: fix typo 2015-05-09 20:29:52 +01:00
Wolfgang Corcoran-Mathe dcfa94cdbd join: Add LICENSE header 2015-05-05 10:53:41 +01:00
Hiltjo Posthuma e34bcca3e3 join: remove argv0, it is in arg.h 2015-04-27 16:58:42 +01:00
Wolfgang Corcoran-Mathe cd0b771cbb Add join(1) 2015-04-20 11:24:12 +01:00