2) include stdlib.h for atoi. 3) staticise and constify. 4) add some missing prototypes. 5) add some parens to keep gcc happy.