Add buf library.

It is just a copy with some modification (mostly stylish) from Go's Buf
library (src/cmd/dist/buf.c and src/cmd/dist/a.h).

I'm doing this just for learning, it isn't intended for wide consume.

Signed-off-by: Thiago Farina <tfarina@chromium.org>