/* ** Removes a client from the client list ** if to_free != 0, liberates the client struct */ void remove_client(t_list **list_clients, t_client *cl, int to_free) { t_client *c; t_client ref; my_printf("Client connected on socket %d has been removed\n", cl->socket); ref.socket = cl->socket; c = my_find_elm_eq_in_list(*list_clients, &ref, client_cmp); my_rm_all_eq_from_list(list_clients, &ref, client_cmp); if (to_free) free_client(c); }
int builtin_unsetenv(t_mysh *mysh, char **args) { if (args[1] != NULL && env_key_exist(mysh->my_env, args[1])) my_rm_all_eq_from_list(&mysh->my_env, args[1], find_key); return (1); }