tgrekov-pipex
HIVE pipex May 2024
Loading...
Searching...
No Matches
dispatch.c File Reference

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dispatch.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tgrekov <tgrekov@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/22 13:32:09 by tgrekov #+# #+# */
/* Updated: 2024/05/20 12:27:21 by tgrekov ### ########.fr */
/* */
/* ************************************************************************** */

Definition in file dispatch.c.

#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <libft.h>
#include <ft_printf.h>
#include "../utils/utils.h"
Include dependency graph for dispatch.c:

Go to the source code of this file.

Functions

char * get_cmd (char **paths, char *name)
 Find and return the first existing file with called name from the array of paths.
 
void dispatch (char **paths, char *args, char **envp, int *in_out)
 Dispatch child process with argument string args, environment envp, and stdin / stdout in_out[0] / in_out[1].
 

Function Documentation

◆ dispatch()

void dispatch ( char **  paths,
char *  args,
char **  envp,
int *  in_out 
)

Dispatch child process with argument string args, environment envp, and stdin / stdout in_out[0] / in_out[1].

Parameters
pathsNull-terminated array of paths with trailing forward slashes to search for the executable name in
argsString of arguments that will be split and passed as argv to the child process
envpEnvironment pointer for the child process
in_outstdin and stdout for the child process

Definition at line 67 of file dispatch.c.

References arr_free(), ft_printf(), and ft_split().

Here is the call graph for this function:

◆ get_cmd()

char * get_cmd ( char **  paths,
char *  name 
)

Find and return the first existing file with called name from the array of paths.

Parameters
pathsNull-terminated array of paths with trailing forward slashes
nameName of command to search for
Return values
char*Full path to the command

Definition at line 33 of file get_cmd.c.

References err(), ft_strdup(), and ft_strjoin().

Here is the call graph for this function: