Obsolete
/
libipc-old
Archived
3
0
Fork 0
This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
libipc-old/core-test/app/array_proc.c

35 lines
763 B
C
Raw Normal View History

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 01:54:12 +02:00
struct ipc_client_array clients;
memset(&clients, 0, sizeof(struct ipc_client_array));
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-04 01:54:12 +02:00
ipc_client_array_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-04 01:54:12 +02:00
ipc_client_array_print(&clients);
2016-12-20 23:36:00 +01:00
2018-10-04 01:54:12 +02:00
ipc_client_array_free (&clients);
2016-12-22 21:48:35 +01:00
return 0;
}