Giter VIP home page Giter VIP logo

joshell's Introduction

joshell

By Aryan Bhatt and Gilvir Gill it is BIG

Features:

  • Functioning shell that can execute commands of unlimited length using forking
  • Can execute multiple commands in a line using ; separation (the number of commands is limited by your machine's RAM
  • Implements basic redirection using >, <, and >>
  • Can read in commands from an external file (using redirection)

Attempted:

  • Multiple redirection
  • Pipes

Bugs:

  • Joshel is limited by INT_MAX (not BIG enough)

Functions:

int child_exec(char **);
char * read_in();
char ** split_cmd(char *);
char ** get_args(char *);
int custom_exec(char **);

int child_exec(char **);

Takes in a String array of arguments Forks, and the child runs the command using execvp Returns the child's pid

char * read_in();

Reads from whatever file is defined to be STDIN Uses realloc to create a sufficiently large buffer to hold the string If realloc fails due to lack of available memory space, it returns null Otherwise, it returns the string that was read in (null terminated)

char ** split_cmd(char *);

Takes in a null terminated raw input line Returns a String array that points to each individual command (separates using '\n' and ';' as delimiters

char ** get_args(char *);

Takes in a null terminated string Returns an array of pointers to the arguments, in order The returned pointer will NOT be the same as the inputed pointer

int custom_exec(char **);

Wrapper function for child_exec Accounts for <, >> and > Tries to account for |, but doesn't really work

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.