That was History of the World, Part I. Gregory Hines was pretending to be a eunuch to escape the guards.
Aargh ... you're right!! Thanks. But *another* hilarious Mel Brooks movie :-)