Files
42_INT_07_minishell/srcs/generic/ft_is_posix_name.c
LuckyLaszlo 0e520ef31e fixed crash in builtin export with "" argument
+ builtin unset now update PATH
2021-12-18 13:45:20 +01:00

32 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_posix_name.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 09:25:35 by lperrey #+# #+# */
/* Updated: 2021/12/18 13:31:11 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int ft_is_posix_name(char *str)
{
unsigned int i;
if (!str)
return (0);
if (str[0] != '_' && !ft_isalpha(str[0]))
return (0);
i = 1;
while (str[i])
{
if (str[i] != '_' && !ft_isalnum(str[i]))
return (0);
i++;
}
return (i);
}