Supports both of GNU and BSD version `stat`

fixed #399

Signed-off-by: Rack Lin <racklin@gmail.com>