Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/semx2a/pipex
The Pipex project is a detailed exploration and programming of a UNIX pipe.
https://github.com/semx2a/pipex
c file pipeline redirections shell unix unix-shell
Last synced: 6 days ago
JSON representation
The Pipex project is a detailed exploration and programming of a UNIX pipe.
- Host: GitHub
- URL: https://github.com/semx2a/pipex
- Owner: semx2a
- Created: 2022-01-18T19:18:12.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-02-21T14:28:27.000Z (9 months ago)
- Last Synced: 2024-02-21T15:57:36.915Z (9 months ago)
- Topics: c, file, pipeline, redirections, shell, unix, unix-shell
- Language: C
- Homepage:
- Size: 573 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pipex
The Pipex project is a detailed exploration and programming of a UNIX pipe. The project is coded in C and adheres to the 42 School coding norm. This project served as an excellent opportunity to gain a deeper understanding of system calls and inter-process communication via pipes in a UNIX-like system.
## Usage
You can launch the test script by running the following command:
```shell
chmod +x test.sh && ./test.sh```
You can use the following arguments to run the test script:
```shell
./test.sh clean # Cleans the project
./test.sh bonus # Runs the bonus project tests
```## Project Description
The Pipex project mimics the behavior of the following simple shell command:
```bash
< file1 cmd1 | cmd2 > file2```
This command takes two commands - `cmd1` and `cmd2` - and two files - `file1` and `file2`. It runs `cmd1` with `file1` as input and `cmd2` with the output of `cmd1` as input. The final output of `cmd2` is then written into `file2`.
The Pipex program is executed in the following way:
```shell
./pipex file1 cmd1 cmd2 file2```
## Skills Gained
Through this project, I have gained a deeper understanding of the following:
- The use of pipes for inter-process communication.
- The use of system calls such as `fork()`, `execve()`, `pipe()`, `dup()`, `dup2()`, and `waitpid()`.
- Handling and redirection of standard input, output and error.
- The use of file descriptors.
- Error handling and memory management in C, ensuring no memory leaks.
- Reading and understanding man pages.
- Working with Makefiles and libraries in C.
- Practical experience with Makefiles and libraries in C.## Bonus
The Pipex project also ventured into additional complexities such as:
- Managing multiple pipes, which extends the functionality to this format:
```shell
./pipex file1 cmd1 cmd2 cmd3 ... cmdn file2```
This is identical to the shell command:
```bash
< file1 cmd1 | cmd2 | cmd3 ... | cmdn > file2```
## Troubleshooting
If you encounter the following error when running make:
```shell
make: *** No rule to make target 'libft.a', needed by 'pipex'. Stop.```
You can fix it by running the following command:
```shell
git submodule update --init --recursive```
If the git submodules didn't clone properly, you can run the following commands to clone the submodules:
```bash
git submodule update --init --force --remote
```