Buildable code from Beej Hall's book