X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=selector.c;h=7f64ebad916ffd831a5c8c590072250459953cb3;hb=56285429e6ad644e31f66b006eeff8a92053def8;hp=9b8879942bec621f8257e82f45c70338af2427bc;hpb=adeac87e367824af309c8bafc0010cbe42d09c6f;p=selector.git diff --git a/selector.c b/selector.c index 9b88799..7f64eba 100644 --- a/selector.c +++ b/selector.c @@ -76,8 +76,9 @@ int attr_modeline, attr_focus_line, attr_error; void *safe_malloc(size_t n) { void *p = malloc(n); - if (!p && n != 0) { - printf("Can not allocate memory: %s\n", strerror(errno)); + if(!p && n != 0) { + fprintf(stderr, + "selector: can not allocate memory: %s\n", strerror(errno)); exit(EXIT_FAILURE); } return p; @@ -290,7 +291,8 @@ int add_and_get_previous_index(struct hash_table_t *hash_table, /* We came back to our original code, which means that the table is full */ if(code == start) { - printf("Full hash table (that should not happen)\n"); + fprintf(stderr, + "Full hash table (that should not happen)\n"); exit(EXIT_FAILURE); } } @@ -791,7 +793,7 @@ void read_file(struct hash_table_t *hash_table, exit(EXIT_FAILURE); } - while(*nb_lines < nb_lines_max && (fgets(raw_line, BUFFER_SIZE, file))) { + while(*nb_lines < nb_lines_max && fgets(raw_line, BUFFER_SIZE, file)) { for(s = raw_line + strlen(raw_line) - 1; s > raw_line && *s == '\n'; s--) { *s = '\0'; } @@ -1221,7 +1223,7 @@ int main(int argc, char **argv) { /* Here we come back to standard display */ - if((key == KEY_ENTER || key == '\n')) { + if(key == KEY_ENTER || key == '\n') { char *t;