improved variable matching in getd()

strmatch does not return unique results, replaced with strcmp