now compiles almost w/o warnings with -std=c99 -pedantic