Coder Social home page Coder Social logo

pipex's Introduction

pipex

introduction

The aim of this project is to start working with Unix processes. In this project, we have to reproduce Bash's pipe operator (|), whose effect is to redirect a commands output to be the input of another command.

how to use

After running make in the project's directory, you can run commands that have the following form:

./pipex input.txt cmd1 cmd2 output.txt

is equivalent to Bash's:

< input.txt cmd1 | cmd2 > output.txt

I support multiple pipes, so:

./pipex input.txt cmd1 cmd2 cmd3 cmd4 output.txt

is equivalent to Bash's:

< input.txt cmd1 | cmd2 | cmd3 | cmd4 > output.txt

authorized functions

  • open: opens a file and returns a file descriptor
  • close: closes a file pointed to by a file descriptor
  • read: reads from a file descriptor
  • write: writes to a file descriptor
  • malloc: allocates memory on the heap
  • free: frees memory on the heap
  • perror: prints an error message to stderr
  • strerror: returns string corresponding to an error code
  • access: checks if we have access to a given filename
  • dup: duplicates a file descriptor
  • dup2: duplicates a file descriptor and gives it the value we want
  • execve: replaces the current process with the program given
  • exit: exits a program with a given return status
  • fork: duplicates the current process
  • pipe: creates a pair of file descriptors that can allow two processes to communicate
  • unlink: remove a file
  • wait: waits for a child process to finish
  • waitpid: waits for a given child process to finish

pipex's People

Contributors

sophiakoulen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.