A start on a C API for pipestatic

Some code in `stats_loop` courtesy of @timdoug from his time at
@bumptech.
Store the stat name in a char array

The previous code would have failed with a stack corruption eventually.