https://github.com/0xromjobert/pipex
a 42 school project to rebuild shell redirections by handling pipes in C
https://github.com/0xromjobert/pipex
c child-process commad-line dup2 execve pipe shell
Last synced: 26 days ago
JSON representation
a 42 school project to rebuild shell redirections by handling pipes in C
- Host: GitHub
- URL: https://github.com/0xromjobert/pipex
- Owner: 0xromjobert
- Created: 2023-07-25T15:21:00.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T21:05:16.000Z (over 1 year ago)
- Last Synced: 2025-03-31T18:46:55.124Z (about 1 month ago)
- Topics: c, child-process, commad-line, dup2, execve, pipe, shell
- Language: C
- Homepage:
- Size: 437 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pipex
pipex is a 42 school project designed to understand shell redirections and pipes by building them in C. Parent-children processes communication is done by leveraging the shared nature (between processes) of file descriptors to the open file table.
This pipex program takes an input file, execute a command on it, pipes the result to another command which then writes its result to an output file.
The result should mimic exactly the shell command:
`$ < input_file command1 | command2 > output file`
this include error exit code and messages for every cases.
It is built using the following system functions and system calls `open`, `close`, `read`, `write`,
`dup2`, `execve`, `fork`, `pipe`, `waitpid`## Status
Finished 25/07/2023.
Grade: 100%
## Usage
Compile with `make`
### Execution
Pipex can handle 2 commands :
```
./pipex input_file command1 command2 output_file
```this will execute the same as the following shell command :
`$ < input_file command1 | command2 > output_file`
You could test with an input_file containing "Go dance salsa somewhere Christina :)”