Skip to content

FlorentBelotti/42_cursus_pipex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42_cursus_Pipex---------------------------------------------------

C

Summary---------------------------------------------------

Usage---------------------------------------------------

To use the Pipex program, run the following command:

./pipex file1 cmd1 cmd2 file2

Example:

./pipex infile "ls -l" "wc -l" outfile

This command is equivalent to the shell command:

< infile ls -l | wc -l > outfile

Features---------------------------------------------------

  • Handles pipes and redirects the input and output of commands.
  • Mimics the behavior of the following shell command:
    < file1 cmd1 | cmd2 > file2
  • Supports various Unix system calls such as open, close, read, write, malloc, free, perror, strerror, access, dup, dup2, execve, exit, fork, pipe, unlink, wait, and waitpid.
  • Bonus features:
    • Handles multiple pipes.
    • Handles the "here_doc" functionality.

Code Overview---------------------------------------------------

The project is organized into several source files, each handling different aspects of the program:

  • pipex.c: Contains the main function and program entry point.
  • handle_process.c: Manages the creation and execution of child processes.
  • handle_path.c: Handles path resolution for executable commands.
  • pipex_bonus.c: Contains additional functionality for handling multiple pipes and "here_doc".
  • bonus_utils.c: Utility functions for bonus features.
  • bonus_handle_process.c: Manages processes for the bonus part of the project.
  • bonus_handle_path.c: Handles path resolution for bonus features.
  • bonus_handle_here_doc.c: Manages the "here_doc" functionality.

Feedback---------------------------------------------------

The Pipex project is not a significant technical challenge. The real challenge lies in understanding the use and functioning of pipes in a shell and in a C program. It is often recommended to complete Pipex before tackling Minishell, as the latter also uses this concept. I would make the same suggestion.

Implementing Pipex and its bonuses is generally not very difficult. The most time-consuming part is understanding and mastering the use of processes in a C program. Once you grasp this logic, the rest of the project becomes relatively straightforward to implement.

Thanks---------------------------------------------------

To Jeguerin (JayZ66): who greatly helped me understand the functionality and utility of pipes. Having already completed this project, she allowed me to build on hers and explained its workings so that I could develop my own.

About

Create and manage pipes | and process.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published