Add basic window resize handling

Catch SIGWINCH which is raised whenever the window is resized. When we
get this signal we re-calculate display_nr_hdrs.

We move this calculation out into its own helper function.as we now want
to do this in multiple locations.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
Make buf local to functions where it's used

Remove its global declaration and delcare it locally in the functions
where it's used.

As well as this being global we were passing it around to functions
also. Not sure if thats good or bad, but this should be more clear whats
going on now.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
Have read_pop_response_sync() nul terminate the data

Seeing as what we get from the POP server is ascii text, we should never
get '\0' as part of the data, and adding the nul byte here simplifies
things elsewhere and will help with future work.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
Add a specific RETR handler

Add a function to specifically handle RETR commands. This uses
read_pop_response_sync() to read the message and avoids the command
prompt from being interspersed within the message as it no longer goes
round the select loop.

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>