script: move do_io() content to small functions

The do_io() got to be a bit long with relatively deep indentation.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
script: replace strftime() workaround with CFLAGS = -Wno-format-y2k

Nowadays, gcc(1) provides the -Wno-format-y2k option to prevent the
warning, so that the above workaround is no longer required.

Reference: http://man7.org/linux/man-pages/man3/strftime.3.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
script: use correct input type, move comment, and so on

Minor corrections.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>