MB-9999 Add stdin integer reader method

Using fscanf directly to read newline separated integers
from stdin have few pitfalls. For example, if we are trying
to read a newline separated integer from stdin using
fscanf(stdin, "%d\n", &x), when you send exactly "123\n"
to stdin, still fscanf will block until a non whitespace
character (mismatching isspace()) arrives or EOF is reached.

Since the erlang port does not close the other end of stdin,
it will never receive EOF. Hence, it will indefinitely block
expecting a non whitespace character. This case happens in
the native view group cleaner if there is no reducers for a
view.

Added a separate method for reading a line from stdin and
parse integer using sscanf.

Change-Id: Ie64cadf59b87c580d3251b9f67bb9ddff21b4a9a
Reviewed-on: http://review.couchbase.org/32854
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>