mal-dnssearch.sh: major bug fixes in v1.0.0 release

I failed to test the parsing of the newly restructured options
and the result has been that I found out there were big mistakes
after the fact with the parse function and other handlings.

This commit addresses those and revises some of the code to make
it simpler.