Add validate_cmd function

This PR adds a new `validate_cmd` function, which takes a string and a command, and validates the string against the command. Example:

    validate_cmd("root ALL=(ALL) ALL\n", "/usr/sbin/visudo -c -f")

Like all `validate_*` functions, it fails compilation if the check fails. It also takes an optional 3rd argument to specify a nicer message.