Skip to content

This project will let you discover in detail a UNIX mechanism, the |PIPE|.

Notifications You must be signed in to change notification settings

AnaVolkmann/42_PIPEX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipex

fract-ol_badge/

Reproduction of shell pipes


Final score

fractol_grade/

About pipex_pipe/

Pipex is a C project that simulates the behavior of the shell when piping the output of one command to the input of another using the | operator. The project involves using system calls like fork(), pipe(), dup2(), and execve() to create a pipeline between two processes, enabling them to communicate by passing data from one command to another, just as you would in a Unix-like shell.

# ./pipex infile cmd1 cmd2 outfile
pipe()
 |
 |-- fork()
      |
      |-- child // cmd1
      :     |--dup2()
      :     |--close end[0]
      :     |--execve(cmd1)
      :
      |-- parent // cmd2
            |--dup2()
            |--close end[1]
            |--execve(cmd2)
 
# pipe() sends the output of the first execve() as input to the second execve()
# fork() runs two processes (i.e. two commands) in one single program
# dup2() swaps our files with stdin and stdout

About

This project will let you discover in detail a UNIX mechanism, the |PIPE|.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published