select_none();
}
+void remove_duplicates()
+{
+ int i,j,k;
+ char *tmpj;
+ if(list_is_empty())
+ return;
+
+ /* Scan from the last one */
+ for(j = LAST_ITEM - 1; j >= 0; j--) {
+ tmpj = db_name_get(j);
+ for(i = LAST_ITEM; i > j; i--)
+ /* Check name and merge if dups */
+ if (0 == strcmp(tmpj,db_name_get(i))) {
+ item_merge(database[j],database[i]);
+ if (curitem == i) curitem--;
+ for(k = i; k < LAST_ITEM; k++) {
+ item_copy(database[k], database[k + 1]);
+ }
+ item_free(&database[LAST_ITEM]);
+ items--;
+ }
+ }
+
+ adjust_list_capacity();
+}
+
+
char *
get_surname(char *s)
{
int save_database();
void remove_selected_items();
void merge_selected_items();
+void remove_duplicates();
void sort_surname();
void sort_by_field(char *field);
void close_database();
N_(" r / del remove selected items\n"),
N_(" M merge selected items (into top one)\n"),
N_(" D duplicate item\n"),
+N_(" U remove duplicates\n"),
"\n",
N_(" space select item\n"),
N_(" + select all\n"),
case 'r': ui_remove_items(); break;
case 'M': ui_merge_items(); break;
case 'D': duplicate_item(); break;
+ case 'U': ui_remove_duplicates(); break;
case 12: refresh_screen(); break;
case 'k':
refresh_list();
}
+void ui_remove_duplicates()
+{
+ if(statusline_ask_boolean(_("Remove duplicates"), TRUE))
+ remove_duplicates();
+
+ clear_statusline();
+ refresh_list();
+}
+
void
ui_clear_database()
{
void get_commands();
void ui_remove_items();
void ui_merge_items();
+void ui_remove_duplicates();
void ui_clear_database();
void ui_find(int next);
void ui_print_number_of_items();