Somewhat streamline event loop/restart/quit handling; most notable
change allows a restart to trigger proper teardown first, even though
teardown is not (yet) complete.

After some discussion with oga@nicotinebsd.org regarding a more
complicated version/idea.
start properly releasing X resources during teardown
cwm_argv doesn't need to be global any longer
zap whitespace
If no title is supplied, term uses only the basename for its title.
This is useless when searching for windows launched via the ssh command
menu; supply a more useful title: '[ssh] <hostname>'.

Idea from todd@, ok todd@
no need to quote within warning
correct arguments and drop the cast.

sanity check by oga@nicotinebsd
more range checking
cvsimport