30 lines
1.1 KiB
C
30 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/16 03:50:43 by lperrey ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "minishell.h"
|
|
|
|
int ft_is_posix_name(char *str)
|
|
{
|
|
unsigned int i;
|
|
|
|
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);
|
|
}
|