{"id":28042324,"url":"https://github.com/nabilac27/42-pipex","last_synced_at":"2025-05-11T14:26:08.719Z","repository":{"id":276333294,"uuid":"918949182","full_name":"nabilac27/42-pipex","owner":"nabilac27","description":"pipex is a C program that simulates a shell pipeline, using pipes and process management to execute commands, handle file redirection, and facilitate inter-process communication.","archived":false,"fork":false,"pushed_at":"2025-04-10T02:15:23.000Z","size":1565,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T03:24:31.619Z","etag":null,"topics":["command-execution","concurency","environment-variables","error-handling","file-descriptor","file-handling","input-output","inter-process-communication","memory-management","pipeline","pipes","process-management","redirection","string-manipulation"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nabilac27.png","metadata":{"files":{"readme":"docs/README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-19T10:06:13.000Z","updated_at":"2025-04-10T02:15:26.000Z","dependencies_parsed_at":"2025-02-07T16:25:54.528Z","dependency_job_id":"66d94f95-71ff-4761-a46d-72039616529c","html_url":"https://github.com/nabilac27/42-pipex","commit_stats":null,"previous_names":["nabilac27/pipex","nabilac27/42-pipex"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-pipex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-pipex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-pipex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nabilac27%2F42-pipex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nabilac27","download_url":"https://codeload.github.com/nabilac27/42-pipex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253578779,"owners_count":21930599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-execution","concurency","environment-variables","error-handling","file-descriptor","file-handling","input-output","inter-process-communication","memory-management","pipeline","pipes","process-management","redirection","string-manipulation"],"created_at":"2025-05-11T14:26:08.147Z","updated_at":"2025-05-11T14:26:08.698Z","avatar_url":"https://github.com/nabilac27.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **pipex**\n\nThe **pipex** project is a C program that simulates a shell pipeline. \n\nIt uses pipes to connect commands, handles file redirection, and manages multiple processes. \n\nThe program takes two input files and a set of commands, then pipes the commands together and outputs the result.\n\n\n## **Key Concepts**\n\n- **Pipes**: Used to pass the output of one command as input to another.\n  \n- **Process Management**: The program uses `fork()` to create child processes to execute commands, with communication happening through pipes.\n  \n- **File Redirection**: Reads from or writes to files by redirecting input/output.\n\n- **Environment Variables**: Uses the `PATH` variable to locate commands in system directories.\n\n- **Error Handling**: Displays an error message and exits the program if something goes wrong (e.g., invalid commands or failure to create pipes).\n\n## How to Run\n#### **Make the project**:\nTo compile the `pipex` project, run the following command:\n```bash\n$ make\n```\n\n#### **Run the program**:\nTo run the program, use the following format:\n```bash\n$ ./pipex file1 cmd1 cmd2 file2\n```\n- file1 is the input file for the first command.\n- cmd1 is the first command to execute.\n- cmd2 is the second command to execute.\n- file2 is the output file where the result of the pipeline will be written.\n\n#### **Example**:\n```bash\n$ ./pipex input.txt \"cat\" \"grep keyword\" output.txt\n```\n\n#### **Rebuild**:\nTo rebuild the project from scratch (after using fclean), run:\n```bash\n$ make re\n```\n\n---\n\n## **Functions Overview**\n\n| **Function**                            | **Description** |\n|-----------------------------------------|-----------------|\n| `left_process(char *argv[], char *envp[], int fd[])` | Executes the first command in the pipeline and manages its redirection. |\n| `right_process(char *argv[], char *envp[], int fd[])` | Executes the second command in the pipeline and manages its redirection. |\n| `execute_cmd(char *cmd, char *envp[])`  | Finds and runs a command by checking the system's `PATH`. |\n| `get_path(char *cmd, char *envp[])`     | Finds the full path of a command in the `PATH` directories. |\n| `error_message(char *message)`          | Displays an error message and exits the program if something goes wrong. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabilac27%2F42-pipex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnabilac27%2F42-pipex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnabilac27%2F42-pipex/lists"}