Fixed stuff

This commit is contained in:
Maix0 2024-05-18 18:49:15 +02:00
parent be1d3ff2d3
commit f4e8596f3b
15 changed files with 130 additions and 103 deletions

View file

@ -6,19 +6,20 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/04 22:25:44 by maiboyer #+# #+# */
/* Updated: 2024/05/09 16:57:24 by rparodi ### ########.fr */
/* Updated: 2024/05/18 18:38:01 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/types.h"
#include <stdbool.h>
#include <stdio.h>
bool find_null(const t_str *s)
bool find_null(const t_str *s)
{
return (s == NULL);
}
bool str_start_with(t_const_str s, t_const_str prefix)
bool str_start_with(t_const_str s, t_const_str prefix)
{
while (*prefix && *s)
{
@ -28,9 +29,14 @@ bool str_start_with(t_const_str s, t_const_str prefix)
return (*prefix == '\0');
}
bool find_path(const t_str *s)
bool find_path(const t_str *s)
{
t_str ss;
if (*s == NULL)
return (false);
return (str_start_with(*s, "PATH="));
ss = *s;
printf("%s\n", ss);
return (ss[0] == 'P' && ss[1] == 'A' && ss[2] == 'T' && ss[3] == 'H' &&
ss[4] == '=');
}