generic.c file split
This commit is contained in:
29
srcs/generic/ft_is_posix_name.c
Normal file
29
srcs/generic/ft_is_posix_name.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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);
|
||||
}
|
||||
Reference in New Issue
Block a user