2018-10-04 01:22:50 +02:00
|
|
|
#include "../../core/client.h"
|
2016-12-20 23:36:00 +01:00
|
|
|
#include <string.h> /* memset */
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-12-22 21:48:35 +01:00
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int ret;
|
2018-10-04 22:51:31 +02:00
|
|
|
struct ipc_clients clients;
|
|
|
|
memset(&clients, 0, sizeof(struct ipc_clients));
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2018-10-04 01:22:50 +02:00
|
|
|
struct ipc_client client_tab[5];
|
|
|
|
memset(&client_tab, 0, sizeof(struct ipc_client) * 5);
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2016-12-22 21:48:35 +01:00
|
|
|
int i;
|
|
|
|
for (i = 0; i < 5; i++) {
|
2018-10-04 01:22:50 +02:00
|
|
|
client_tab[i].proc_fd = i;
|
2018-10-04 01:54:12 +02:00
|
|
|
ret = ipc_client_add(&clients, &client_tab[i]);
|
2016-12-22 21:48:35 +01:00
|
|
|
if (ret == -1) {
|
|
|
|
printf("erreur realloc\n");
|
|
|
|
}
|
|
|
|
}
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2018-10-08 16:15:35 +02:00
|
|
|
ipc_clients_print(&clients);
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2018-10-04 01:54:12 +02:00
|
|
|
ret = ipc_client_del(&clients, &client_tab[2]);
|
2016-12-22 21:48:35 +01:00
|
|
|
if(ret < 0) {
|
|
|
|
printf("erreur %d\n", ret );
|
|
|
|
}
|
2018-10-08 16:15:35 +02:00
|
|
|
ipc_clients_print(&clients);
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2018-10-08 16:15:35 +02:00
|
|
|
ipc_clients_free (&clients);
|
2016-12-22 21:48:35 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|