2016-12-20 23:36:00 +01:00
|
|
|
#include "../../core/process.h"
|
|
|
|
#include <string.h> /* memset */
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-12-22 21:48:35 +01:00
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
struct array_proc tab_proc;
|
|
|
|
memset(&tab_proc, 0, sizeof(struct array_proc));
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2016-12-22 21:48:35 +01:00
|
|
|
struct process process_tab[5];
|
|
|
|
memset(&process_tab, 0, sizeof(struct process) * 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++) {
|
|
|
|
process_tab[i].proc_fd = i;
|
|
|
|
ret = add_proc(&tab_proc, &process_tab[i]);
|
|
|
|
if (ret == -1) {
|
|
|
|
printf("erreur realloc\n");
|
|
|
|
}
|
|
|
|
}
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2016-12-22 21:48:35 +01:00
|
|
|
array_proc_print(&tab_proc);
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2016-12-22 21:48:35 +01:00
|
|
|
ret = del_proc(&tab_proc, &process_tab[2]);
|
|
|
|
if(ret < 0) {
|
|
|
|
printf("erreur %d\n", ret );
|
|
|
|
}
|
|
|
|
array_proc_print(&tab_proc);
|
2016-12-20 23:36:00 +01:00
|
|
|
|
2016-12-22 21:48:35 +01:00
|
|
|
array_proc_free (&tab_proc);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|