Zappy - Year end project 2
This is a project that Epitech asked us to create in order to allow us to reveiw the notions of the current year.
Loading...
Searching...
No Matches
Functions
command_parse.c File Reference
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "utils.h"
#include "command_parse.h"
Include dependency graph for command_parse.c:

Go to the source code of this file.

Functions

int check_command_exist (char **command)
 Verify if command exist and if it is valid.
 
char ** parse_command (char *str)
 Parse a command using COMMAND_DELIMITER as delimiter.
 
char *** parse_buffer (uint8_t *buffer, ssize_t buf_size)
 Get all command in buffer (a command is delimited by COMMAND_SEPARATOR)
 

Function Documentation

◆ check_command_exist()

int check_command_exist ( char ** command)

Verify if command exist and if it is valid.

Parameters
commandarray to verify
Returns
EXIT_SUCCESS or EXIT_FAILURE

Definition at line 35 of file command_parse.c.

◆ parse_buffer()

char *** parse_buffer ( uint8_t * buffer,
ssize_t buf_size )

Get all command in buffer (a command is delimited by COMMAND_SEPARATOR)

Parameters
bufferRead buffer from server
buf_sizeSize of buffer
Returns
Parsed command splited with SPACE as delimiter or NULL on error

Definition at line 97 of file command_parse.c.

◆ parse_command()

char ** parse_command ( char * str)

Parse a command using COMMAND_DELIMITER as delimiter.

Parameters
strCommand string to parse
Returns
Parsed command or NULL on error

Definition at line 48 of file command_parse.c.