tools: remove dependency on glibc program_invocation_[short_]name
Platforms like Bionic libc don't have program_invocation_[short_]name,
which is a GNU extension. It does have getprogname(), a BSD extension,
but rather than supporting multiple extensions let's just introduce
our own local helpers.
We derive the short name ourselves rather than calling basename(),
as the POSIX version takes char *, not const char *, and is thus
not guaranteed to avoid modifying its input. (The GNU version does
take const char * but we are avoiding extensions here.)
Signed-off-by: Benjamin Li <benl@squareup.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>