int headas_init(int, char **) Calls routines to initialize PIL and output streams. It also deals with standard HEAdas parameters (chatter, clobber, history).
int headas_close() Closes output streams and PIL.
int hdIOInit() Checks environment variables (eg, HEADASOUTPUT, HEADASERROR) and sets up output streams.
int hd_pil_err_logger(char *s) Default PIL error logging routine. Simply prints to stderr.
headas_main.c This file comprises the main program unit for every task. It calls headas_init() followed by the task subroutine itself and then calls headas_close() after the task completes. This main routine is not part of any library and must be explicitly included by all C tasks (via #include "headas_main.c"). For f77 tasks it is automatically compiled and linked in by the Makefile.