hdsOpen: Fix memory leak
Rewrite filename checking code to support wildcard expansion

This is important for ICL which expected $ADAM_USER to be
expanded by HDS. Most other parts of Starlink use NDG and so
do not need HDS to do this. Made possible by the recent addition
of tuning support.