add -1 return value to function validate_cmd