Handle systems without telldir()

To discover whether a glob points to a dirhandle on
those systems, some B trickery is required.