diff --git a/src/addmult.c b/src/addmult.c index 3f6d39d0..b583d9f7 100644 --- a/src/addmult.c +++ b/src/addmult.c @@ -360,7 +360,6 @@ int init_and_load_multipliers(void) { } while ((read = getline(&s_inputbuffer, &s_inputbuffer_len, cfp)) != -1) { - if (read != -1) { if (s_inputbuffer_len > 0) { /* strip leading and trailing whitespace */ g_strstrip(s_inputbuffer); @@ -372,12 +371,10 @@ int init_and_load_multipliers(void) { add_mult_line(s_inputbuffer); } - } - else { - printf("RuntimeError: %ld", read); - exit(1); - } - + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } fclose(cfp); diff --git a/src/bandmap.c b/src/bandmap.c index ee0d8f37..b39da1da 100644 --- a/src/bandmap.c +++ b/src/bandmap.c @@ -189,8 +189,16 @@ void bmdata_read_file() { free_spot(entry); } } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } if (line != NULL) free(line); diff --git a/src/cabrillo_utils.c b/src/cabrillo_utils.c index 28bdadd5..d6f26c8a 100644 --- a/src/cabrillo_utils.c +++ b/src/cabrillo_utils.c @@ -609,6 +609,10 @@ static int process_cabrillo_template_file(const char *file_name) { break; } } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (logline != NULL) diff --git a/src/checklogfile.c b/src/checklogfile.c index a64545b9..adf8880b 100644 --- a/src/checklogfile.c +++ b/src/checklogfile.c @@ -101,6 +101,10 @@ int repair_log(char *filename) { fputs(buffer, outfp); fputs("\n", outfp); } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (buffer != NULL) @@ -200,6 +204,10 @@ int checklogfile_new(char *filename) { tooshort = 1; } } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (buffer != NULL) @@ -275,6 +283,10 @@ void checklogfile(void) { } fputs(inputbuffer, outfile); } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (inputbuffer != NULL) diff --git a/src/dxcc.c b/src/dxcc.c index 46f6bfb9..f23b89be 100644 --- a/src/dxcc.c +++ b/src/dxcc.c @@ -362,6 +362,10 @@ int load_ctydata(char *filename) { } } } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (buf != NULL) diff --git a/src/initial_exchange.c b/src/initial_exchange.c index 8276654d..3c444122 100644 --- a/src/initial_exchange.c +++ b/src/initial_exchange.c @@ -148,7 +148,11 @@ struct ie_list *make_ie_list(char *file) { /* prepend new entry to existing list */ new->next = ie_listhead; ie_listhead = new; - } + } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (inputbuffer != NULL) diff --git a/src/parse_logcfg.c b/src/parse_logcfg.c index 413477ef..14d711da 100644 --- a/src/parse_logcfg.c +++ b/src/parse_logcfg.c @@ -124,8 +124,12 @@ int parse_configfile(FILE *fp) { if (status != PARSE_OK) { break; } - } } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } + } if (buffer != NULL) free(buffer); @@ -696,6 +700,10 @@ static int cfg_countrylist(const cfg_arg_t arg) { break; } } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } g_free(prefix); @@ -788,6 +796,10 @@ static int cfg_continentlist(const cfg_arg_t arg) { break; } } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } g_free(prefix); diff --git a/src/readcabrillo.c b/src/readcabrillo.c index d1a49e85..597c01db 100644 --- a/src/readcabrillo.c +++ b/src/readcabrillo.c @@ -479,6 +479,10 @@ int readcabrillo(int mode) { while((read = getline(&logline, &read_len, fp1)) != 1) { if (read_len > 0) cab_qso_to_tlf(logline, cabdesc); + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } strcpy(qsonrstr, t_qsonrstr); diff --git a/src/readcalls.c b/src/readcalls.c index 720183e8..dc0dd557 100644 --- a/src/readcalls.c +++ b/src/readcalls.c @@ -190,6 +190,10 @@ int readcalls(const char *logfile, bool interactive) { g_ptr_array_add(qso_array, qso); } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } fclose(fp); diff --git a/src/readqtccalls.c b/src/readqtccalls.c index 61d347fe..5d4b9a7b 100644 --- a/src/readqtccalls.c +++ b/src/readqtccalls.c @@ -89,6 +89,10 @@ int readqtccalls() { last_qtc = tempi; } } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (inputbuffer != NULL) @@ -125,6 +129,10 @@ int readqtccalls() { total++; /* add one point per QTC */ } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (inputbuffer != NULL) @@ -145,6 +153,10 @@ int readqtccalls() { /* remember callsign, mark it as QTC capable, based on eg. last years */ if (inputbuffer_len > 0) qtc_inc(g_strstrip(inputbuffer), QTC_CAP); + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (inputbuffer != NULL) @@ -161,6 +173,10 @@ int readqtccalls() { /* remember callsign, set marked QTC states */ if (inputbuffer_len > 0) parse_qtc_flagline(inputbuffer); + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (inputbuffer != NULL) diff --git a/src/searchlog.c b/src/searchlog.c index 09e622d5..dc88941f 100644 --- a/src/searchlog.c +++ b/src/searchlog.c @@ -799,6 +799,10 @@ int load_callmaster(void) { g_hash_table_add(callset, call); g_ptr_array_add(callmaster, call); } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } g_hash_table_destroy(callset); diff --git a/src/writecabrillo.c b/src/writecabrillo.c index a882e691..9e9aaa28 100644 --- a/src/writecabrillo.c +++ b/src/writecabrillo.c @@ -100,11 +100,16 @@ struct linedata_t *get_next_record(FILE *fp) { int read; while ((read = getline(&buffer, &buffer_len, fp)) != -1) { - if (buffer_len > 0) + if (buffer_len > 0) { if (!log_is_comment(buffer)) { ptr = parse_logline(buffer); return ptr; } + } + else { + perror("RuntimeError: "); + exit(EXIT_FAILURE); + } } if (buffer != NULL) free(buffer);