minishell/src/parser/matchers/metacharacter.c

29 lines
1.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* metacharacter.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/06 15:23:31 by kcolin #+# #+# */
/* Updated: 2025/02/11 19:04:03 by kcolin ### ########.fr */
/* */
/* ************************************************************************** */
#include "metacharacter.h"
// FIXME: use ft_strchr
/*
** return true if the character is a metacharacter
**
** Bash reference manual: A character that, when unquoted, separates words. A
** metacharacter is a space, tab, newline, or one of the following characters:
** |, &, (, ), <, or >.
*/
bool is_metacharacter(char c)
{
if (c == ' ' || c == '\t' || c == '\n' || c == '|' || c == '&'
|| c == '(' || c == ')' || c == '<' || c == '>')
return (true);
return (false);
}