1 #include "print_error.h" 2 #include "main.h" 3 4 // The switch below the order of the error must be in the same as "main.h" 5 // status_t structure, in order to print the correct errors; 6 void print_error(status_t error) 7 { 8 switch (error) { 9 case IO_FILE_NOT_FOUND: 10 fprintf(stderr, MSG_IO_FILE_NOT_FOUND"\n"); 11 break; 12 case ERROR_INVOCATING_PROGRAM: 13 fprintf(stderr, MSG_ERROR_INVOCATING_PROGRAM"\n"); 14 break; 15 case ERROR_NULL_POINTER: 16 fprintf(stderr, MSG_ERROR_NULL_POINTER"\n"); 17 break; 18 case ERROR_LOADING_COUNTRY_CODES: 19 fprintf(stderr, MSG_ERROR_LOADING_COUNTRY_CODES"\n"); 20 break; 21 case ERROR_PRINTING: 22 fprintf(stderr, MSG_ERROR_PRINTING"\n"); 23 break; 24 case ERROR_READING_FILE: 25 fprintf(stderr, MSG_ERROR_READING_FILE"\n"); 26 break; 27 case ERROR_ALLOCATING_TIME: 28 fprintf(stderr, MSG_ERROR_ALLOCATING_TIME"\n"); 29 break; 30 case ERROR_DATA_ON_FILE_MISSING: 31 fprintf(stderr, MSG_ERROR_DATA_ON_FILE_MISSING"\n"); 32 break; 33 default: 34 fprintf(stdin, MSG_OK"\n"); 35 } 36 } 37