Defined _GNU_SOURCE because of use of gnu function use like asprintf()
Commented out unused variable headerlist
Changed main function return values to use EXIT_SUCCESS and EXIT_FAILURE constants