new matcher: metacharacter (separates words)

This commit is contained in:
Khaïs COLIN 2025-02-06 15:48:48 +01:00
parent 60d9b212fb
commit 7a99014485
No known key found for this signature in database
3 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* metacharacter.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/06 15:23:31 by kcolin #+# #+# */
/* Updated: 2025/02/06 15:47:42 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 == '<' || c == '>')
return (true);
return (false);
}