Zappy - Year end project
2
This is a project that Epitech asked us to create in order to allow us to reveiw the notions of the current year.
Loading...
Searching...
No Matches
src
server
src
utils
finder.c
Go to the documentation of this file.
1
/*
2
** EPITECH PROJECT, 2024
3
** server
4
** File description:
5
** finder
6
*/
7
8
#include <string.h>
9
10
#include "
arg_parse.h
"
11
12
void
*
find_value_by_param
(
const
struct
arg_s
**arguments,
const
char
*param)
13
{
14
int
index = 0;
15
16
for
(; index <
NB_PARAM
; index++) {
17
if
(arguments[index] == NULL || arguments[index]->name == NULL) {
18
break
;
19
}
20
if
(strcmp(arguments[index]->name, param) == 0) {
21
return
(arguments[index]->value);
22
}
23
}
24
return
(NULL);
25
}
26
27
int
find_index_by_param
(
const
struct
arg_s
**arguments,
const
char
*param)
28
{
29
int
index = 0;
30
31
for
(; index <
NB_PARAM
; index++) {
32
if
(arguments[index] == NULL || arguments[index]->name == NULL) {
33
break
;
34
}
35
if
(strcmp(arguments[index]->name, param) == 0) {
36
return
(index);
37
}
38
}
39
return
(-1);
40
}
arg_parse.h
NB_PARAM
#define NB_PARAM
! PARSING CONSTANTS !!
Definition
constants.h:20
find_value_by_param
void * find_value_by_param(const struct arg_s **arguments, const char *param)
Definition
finder.c:12
find_index_by_param
int find_index_by_param(const struct arg_s **arguments, const char *param)
Definition
finder.c:27
arg_s
Definition
arg_parse.h:16