Add a tools.c file containing utility functions.