return(0);
}
9. Функция enter_new_cat_entry позволяет вводить новый элемент каталога. Вам не нужно сохранять перевод строки, который возвращает функция fgets, поэтому отбросьте его:
static int enter_new_cat_entry(cdc_entry *entry_to_update) {
cdc_entry new_entry;
char tmp_str[TMP_STRING_LEN + 1];
memset(&new_entry, '\0', sizeof(new_entry));
printf("Enter catalog entry: ");
(void)fgets(tmp_str, TMP_STRING_LEN, stdin);
strip_return(tmp_str);
strncpy(new_entry.catalog, tmp_str, CAT_CAT_LEN - 1);
printf("Enter title: ");
(void)fgets(tmp_str, TMP_STRING_LEN, stdin);
strip_return(tmp_str);
strncpy(new_entry.title, tmp_str, CAT_TITLE_LEN - 1);
printf("Enter type: ");
(void)fgets(tmp_str, TMP_STRING_LEN, stdin);
strip_return(tmp_str);
strncpy(new_entry.type, tmp_str, CAT_TYPE_LEN - 1);
printf("Enter artist: ");
(void)fgets(tmp_str, TMP_STRING_LEN, stdin);
strip_return(tmp_str);
strncpy(new_entry.artist, tmp_str, CAT_ARTIST_LEN - 1);
printf("\nNew catalog entry entry is :-\n");
display_cdc(&new_entry);
if (get_confirm("Add this entry ? ")) {
memcpy(entry_to_update, &new_entry, sizeof(new_entry));
return(1);
}
return(0);