Revert "move endofname() to libbb"

This reverts commit 1961aea305e258ba7ab3910d084451220f55ed44.