libc - Adopt more linux-friendly basename() and dirname()
* Essentially take the FreeBSD basename() and dirname() code, changing
the API to be more linux-friendly. This reduces work required in dports.
* Adjust numerous cases in our base code that assumed the old prototypes
and side effects.
* The passed-in string pointers are no longer const and can be modified
in-place by the functions. The returned value is no longer sometimes
dynamically allocated and will instead either return a constant string,
a portion of the passed in string, or a modified portion of the
passed-in string.
The API unfortunately has to be declared to return a char * instead of
a const char *, even though it sometimes returns pointers to constant
strings.
The API is now thread-safe.
* The API is still a huge historical mess but at least the ports for
the most part assume the above behavior now due to linux doing the
same thing.
Reviewed-by: multiple people
- [DB] sbin/devfsctl/devfsctl.c