CSCE 3600 Systems Programming Shell Assignment


CSCE 3600 Systems Programming Shell Assignment


You should complete this assignment as a group of around 3, submitting on GitLab. All source code must be in the master branch of your GitLab project. Make sure that you list the names of all group members who participated in this assignment in order for each to get credit.

This assignment assumes a group of 3, working for approximately 3 weeks. There is enough work to keep each individual busy. Please identify the area of responsibility for each team member. In the event that team members are not able to complete their work, the grades of other team members will not be affected.

Program Description

Your team is to write a command interpreter (shell) which runs under Linux. A shell is a program which acts as a user interface for an operating system. There are graphical shells, and there are text-based shells such as sh (the Bourne shell), csh (the C shell), bash (the Bourne Again shell).

You have already completed part of this as part of recitation 5 and minor 2. This program will have more features, and take more time to complete.

Please note: You must not provide any extra output beyond what is required. If you have any doubt how your shell should behave, experiment with other shells such as bash and sh and follow their example.  CSCE 3600 Systems Programming Shell Assignment

Major features:

  • Interactive program execution
  • Variable substitution within command lines
  • Proper quote handling
  • Pipeline and file redirection support
  • Configuration file (.xshrc)
  • Execute shells scripts written for your shell

You should be using readline(3) for this assignment. This is a very complicated library routine, but easy to use. I must confess to not knowing all the abilities of this library even after using it for over 30 years. What do you get for (almost) free?

  • History (including search)
  • Emacs and vi editing modes
  • Ignores comments
  • Customizable behavior like matching parenthesis
  • Command completion with tab
  • Macros

When the shell starts, it shall read and interpret commands from a configuration file. These lines will be treated as if they were typed by the user, and should receive no special handing. You should write one interpreter loop which takes input from both this file, and the user once the shell has completed startup. CSCE 3600 Systems Programming Shell Assignment

The initialization file will be named “.xshrc” and be placed in the user’s home directory (not the current directory). This directory is identified by the environment variable $HOME. If the file does not exist, or is not readable, your shell will ignore it and enter interactive mode. This is not an error.

Your shell shall inherit the environment variables from its parent. You do not need to do anything for this to happen, as exported variables are automatically available to children such as your shell. You do need to consult these variables at times. You may access the environment variables either through the envp pointer passed to main, or via the getenv(3) library routine. I recommend using getenv(3).

Recall that the notation getenv(3) means the getenv documented in section 3 of the Unix manual. You may type “man 3 getenv” to read that page. 

Configuration File Support This should be a pretty easy feature, if you have the rest of your shell working. I would leave this until the end of your project.

Your shell should attempt to open the file $HOME/.xshrc. If the file exists and is readable (if open succeeds) then you will read the contents and process them just like typed commands. I assume that you will use the same command-interpreter code, and just feed lines from the file to it. After initialization you will begin processing lines of text from stdin until you see an end-of-file or the user runs the command “exit”.

Command Line Processing You will process command lines entered by the user from the keyboard or a file. You did this in major 2, and may reuse the code if you wish. I strongly recommend that you use the readline(3) library routine to read this line in. CSCE 3600 Systems Programming Shell Assignment

Need Help with a similar Assignment?

The post CSCE 3600 Systems Programming Shell Assignment appeared first on EssayPanthers.


Source link

"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp