ed: Fix double-free
After join() is called for the first time, s.str is left pointing
to a string that was just freed. Upon the second call to join(),
it is freed again at the start of the function.
Since the string is reset on every function call, there is no reason
for it to be static, so just replace the initial free with assignment
fold: fix handling of multibyte characters
fold: don't putchar('\n') if last byte is '\n'
fold: fix handling of \b,\r
fold: fix tabstop column count
TODO: sbase-box does not list `install` in command list
Reported by Ethan Sommer
ed: Use fwrite to write lines instead of fputs
We already have the length of the line, so there is no point in
recalculating it before printing.
ed: Add bytecount print to 'w' command
setsid: add optional -f to force fork()
remove sbase-box from PHONY
I have noticed this issue while I was trying to package sbase-box. Since
sbase-box was in the PHONY target, running sbase-box-install caused it to
be rebuilt when it was unnecessary. This also caused options passed to make
to be lost (such as LDFLAGS).
Remove unnecessary initializers of recursor members
libutil/recurse: Simplify adding trailing slash
We know that r->pathlen < sizeof(r->path) since r->path is
nul-terminated, so we can safely add a '/' here. If there is no
space left over for the rest of the path and nul-terminator, this
will be caught by the subsequent estrlcpy.
du: recurse: fix path
path is not fixed up on exit from recursive step, this leads to
incorrect paths in du's output.
% find D
% du D
% ~/sbase/du D
install: Unlink destination file on failure
install: Use fchown to change owner
find: Fix buffer overflow in token stack
The stack is used for two purposes: storing operators for the
shunting yard algorithm, and storing primitives when arranging the
operators into a tree. The number of operators is bounded by the
number of arguments, since we only insert at most one extra operator
per primitive. However, the number of primitives may be as high as
argc + 1, since -print may have been added implicitly.
This can triggered with an empty expression, `find .`, since in
this case argc is 0, but we still try to store -print in the stack.
Detected with musl's WIP allocator, mallocng-draft.
Add implementation of dd(1)
paste: Minor style tweaks
Convert for-loop with no initial or continue expression into a
Drop unnecessary parentheses.
paste: Support -d '\0'
POSIX specifies that -d '\0' sets the delimiter to an empty string.