Improve interface of np_expect_match() function

Replace the three boolean parameters of lib/utils_tcp.c's
np_expect_match() function with a single "flags" parameter.
check_tcp: Properly deal will partial recv(3)s

The np_expect_match() function now returns one of three possible states
instead of just TRUE or FALSE:

- NP_MATCH_SUCCESS
- NP_MATCH_FAILURE
- NP_MATCH_RETRY

The NP_MATCH_RETRY state indicates that matching might succeed if
np_expect_match() is called with a longer input string.  This allows
check_tcp to decide whether it makes sense to wait for additional data
from the server.
Minor cosmetic changes
check_tcp: Fix checks without --expect string

Commit e8044713d41f5ef1d9ce814df4a079d8f92306b0 broke check_tcp checks
without --expect string, this commit fixes that regression.
tests: make sure tests don't hang
tests: sort cached settings before save
check_tcp: only test ipv6 if ping6 works
check_snmp: add timeout handler befor running snmpget