42sh 1.0.0
Create a shell in C
Loading...
Searching...
No Matches
parsing.c File Reference

The file containing the parsing functions. More...

Functions

char char_is_inhibited (char *str, int index)
 Check if a character is inhibited.
 
int char_is_paranthesed (char *str, int index)
 Check if a char is paranthesed.
 
int char_is_protected (char *str, int index)
 Check if a char is protected.
 
char * find_valid_str (char *str, char const *to_find)
 Find a valid string in a string depending on inhibitors and parentheses.
 
int is_valid_variable (char *variable, char *builtin)
 Check if the variable is valid.
 

Detailed Description

The file containing the parsing functions.

Function Documentation

◆ char_is_inhibited()

char char_is_inhibited ( char * str,
int index )

Check if a character is inhibited.

Parameters
strThe string to check
indexThe index of the character
Returns
char The inhibitor if the character is inhibited, 0 otherwise

◆ char_is_paranthesed()

int char_is_paranthesed ( char * str,
int index )

Check if a char is paranthesed.

Parameters
strThe string
indexThe index
Returns
int 1 if the char is paranthesed, 0 otherwise

◆ char_is_protected()

int char_is_protected ( char * str,
int index )

Check if a char is protected.

Parameters
strThe string
indexThe index
Returns
int 1 if the char is protected, 0 otherwise

◆ find_valid_str()

char * find_valid_str ( char * str,
char const * to_find )

Find a valid string in a string depending on inhibitors and parentheses.

Note
It's an improved version of my_strstr
Parameters
strThe string to check
to_findThe string to find
Returns
char * The address of the string if it's valid, NULL otherwise

◆ is_valid_variable()

int is_valid_variable ( char * variable,
char * builtin )

Check if the variable is valid.

Parameters
variableThe variable
builtinThe builtin who called the function
Returns
int 1 if the variable is valid, 0 otherwise