minishell
Minishell Project for École 42
Loading...
Searching...
No Matches
check_quote_syntax.c File Reference

Functions for checking the syntax of quotes in the input string. More...

#include "minishell.h"
Include dependency graph for check_quote_syntax.c:

Functions

int get_end_quote (const char *input, char c)
 Find the index of the end of a quoted part in a string.
 
bool check_quote_syntax (const char *input)
 Check the syntax of quotes in the input string.
 

Detailed Description

Functions for checking the syntax of quotes in the input string.

Function Documentation

◆ check_quote_syntax()

bool check_quote_syntax ( const char *  input)

Check the syntax of quotes in the input string.

Checks if the syntax of quoted parts (single or double quotes) in the input string is valid. Opening and closing quotes need to be correctly matched. Handles escape characters. If all quoted parts are correct, return true, else return false.

Parameters
inputThe string to be checked.
Returns
Bool Returns true if all parts are valid, otherwise returns false.

◆ get_end_quote()

int get_end_quote ( const char *  input,
char  c 
)

Find the index of the end of a quoted part in a string.

Looks for the end(matching quote) of a quoted part in the input string. The matching quote is given as an argument to the function. If the matching quote is found and is not escaped, its index is returned. Else the entire length of the input string is returned.

Parameters
inputThe input string.
cThe character representing the matching closing quote.
Returns
The index of the matching closing quote, or the lenght of the input string.