gui: Get rid of do_select()'s mode parameter and call it only once.
The current code calls do_select() from three different locations. The
mode parameter indicates whether a command is currently running
and if it is a display command or an external command (where curses
is disabled). This is unnecessarily complex as we can tell from the
values of the command_fd[] array and the cmd_pid variable which mode
we are in.
This commit introduces get_select_mode() which looks at these variables
and returns the current mode. This allows to get rid of the mode
parameter of do_select() and to call do_select() only once at startup
from main(). It now runs in an endless loop, checking the current mode
in each iteration. The other two call sites, exec_and_display_cmd()
and external_cmd(), don't need to call do_select() any more.
This change removes more lines than it adds and makes the logic
of para_gui much simpler to follow. It is also the last big step
to replace the do_select() loop in favor of the standard paraslash
scheduler.