some basic C utilities to help calm the madness