Commit Briefs
kamiftp: print diognistic messages to stderr
excluding the one from cmd_*
kamiftp: automatic cd or fetch on the given path
before the given path was used for Tattach. Turns out at least u9fs doesn't seem to use that field for the initial directory (not sure if it should). kamiftp now always issues a Tattach with aname="/" and then does a Twalk on the path: if it names a directory, it becomes the remote working directory like a `cd' was issued, if it names a file it is fetched and kamiftp quits.
kamiftp: use the [user@]host[:port][/path] syntax
instead of taking the path as a separate argument. For some time the old style will be supported.
endian.h is not universally available
FreeBSD and NetBSD have sys/endian.h, on MacOS we need to use the functions from libkern/OSByteOrder.h see github issue #1
refactor kamiftp internals
use a FILE (constructed either via fdopen over a socket or funopen over libtls) for remote I/O
include compat for reallocarray too
reported by @Et7f3 in github issue #1, thanks!
work around macos lack of accept4(2), SOCK_CLOEXEC and NONBLOCK
I always forget that they're not available on darwin; reported by @Et7f3 in github issue #1
work around missing LOGIN_NAME_MAX
Both Linux and OpenBSD have LOGIN_NAME_MAX available when including limits.h, FreeBSD, Darwin and possibly others don't. FreeBSD (and maybe Darwin) have MAXLOGNAME, so try to use that if available. Otherwise use _POSIX_LOGIN_NAME_MAX, but only has a fallback since it has a lower value (9 at the time of writing). If everything fails, use 32 which is what OpenBSD use by default; OpenSMTPd also defaults to it. See also github issue #1