Strip trailing whitespace. Add a function for it and do it.

Signed-off-by: Geoff Lane <geoff@zorched.net>