void ickpt_share_try_removal(const std::string& owner, const std::string& hash) { std::string hash_file = make_hash_filename(owner, hash); int count = link_count(hash_file.c_str()); if (count == -1) { dprintf(D_ALWAYS, "ickpt_share: link_count error on %s; will not remove\n", hash_file.c_str()); return; } if (count != 1) { dprintf(D_FULLDEBUG, "ickpt_share: link count for %s at %d\n", hash_file.c_str(), count); return; } if (unlink(hash_file.c_str()) == -1) { dprintf(D_ALWAYS, "ickpt_share: unexpected unlink error on %s: %s\n", hash_file.c_str(), strerror(errno)); return; } dprintf(D_FULLDEBUG, "ickpt_share: removed %s\n", hash_file.c_str()); }
//Main function int main() { int choice,n; while(1) { printf("\n1. Insert at beginning\n2. Insert at End\n3. Delete from beginning\n4. Delete from End\n5. Display total\n6. Count elements\n7. Exit"); printf("\nEnter your choice "); scanf("%d",&choice); switch(choice) { case 1 : printf("Enter data : "); scanf("%d", &n); insert_beg(n); break; case 2 : printf("Enter data : "); scanf("%d", &n); insert_end(n); break; case 3: del_beg(); break; case 4: del_end(); break; case 5 : display(); break; case 6: link_count(); break; case 7: exit(1); default : printf("Wrong entry please enter correct choice !!! "); break; } } }