Giter Site home page Giter Site logo

myshell's Introduction

MyShell

Author: Ze Sheng (Owen Sanazas)

Source Files

  • myshell.c
  • shell-behaviour.c
  • shell-behaviour.h
  • job.c
  • job.h
  • utils.c
  • utils.h

Progress

  • ✓ - Finished
  • O - In progess
  • ? - Have problem
  • blank - Not started
Section State
ctrl + c
ctrl + z
Non-interactive mode
Command parser
File redirection
multi-lvl pipeline
job struct
jobList Linkedlist
All job helper funcs
Bultin cmd: jobs
Bultin cmd: fg
Bultin cmd: bg
Memory leaks check
Invalid R/W check
Zombie processes check
Foreground check
Background check

Overview of work accomplished

  • This shell can be run in the non-interactive mode successfully.
  • All commands that are not job control builtins commands are handled by pipe. The standard input/output will be redirected and combining redirection is also supported.
  • We manage each job in a JobNode struct and use a linked list struct JobList to store all background jobs.
    // Job Node
    typedef struct JobNode {
        int pgid;                           // process group id of the current running job
        enum JobStatus status;              // Job status
        struct parsed_command *command;     // job's command
        struct JobNode *prev;               // Prev job pointer
        struct JobNode *next;               // Next job pointer
        int jobId;                          // Job priority
    }JobNode;
    
    
    // Linked-list structure to manage jobs
    typedef struct JobList {
        JobNode *head;
        JobNode *tail;
        int jobCount;
    }JobList;
    
  • Background processes (if existed) will be polled at the beginning of each loop of the shell.
  • The jobs can be managed through job control builtins (fg, bg, jobs).
  • The status of the jobs can be reported correctly.
  • Ctrl-C, Ctrl-D, Ctrl-Z, and other signal are handled correctly.

myshell's People

Contributors

owensanzas avatar

Stargazers

 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.