Add ffs routine needed for upcoming octhci interrupt routine.

Okay miod@
Merge memory leak fix from NetBSD's dir.c revision 1.20, but actually
release all reserved memory chunks in all error cases.

with input by and ok tedu@, ok deraadt@
"mkstr was intended for the limited architecture of the PDP 11 family."
Time moves on, memory gets cheaper. There's no need for mkstr or xstr.
ok deraadt
Do you know what horrors lie beyond that wall?
No.
Then you go first.
ocsp_check_ids says "If algoritm mismatch let caller deal with it" before
returning 2. The one and only caller doesn't check for that, so...
Stop returning it.
ok miod
reduce obvious dependency on global g_pool by moving to local aliases
ok otto
tweak previous;
zap trailing whitespace;
do locatedb as part of the build process
"works for me" deraadt@
KNF.
More KNF.
Make comments readable.
stale prototype