Adding new features to a simple shell implementation, Programming Languages

Assignment Help:

You will be working on creating both a realistic project environment and on adding new features to a simple shell implementation provided in shell.tar.z. After you un-tar it, let's say in your home directory (by typing: tar xzf shell.tar.z), shell subdirectory containing the initial code for your assignment will be created for you. You will keep this directory as a backup in case you need to redo the later parts of the assignment.

The C code for this assignment has already been split into multiple .c and .h files.

The provided Makefile will keep track of the dependencies. When you type make command your application called sshell (that will be the name of your executable file) will be created. Also, your Makefile has clean and run targets; clean will remove all object and executable files; and run will run the application.  

Your tasks are as follows:   

1) You need to add initial comments to all source files (including the Makefile) indicating, at least, file name, purpose, and your name (i.e. programmer's name, and be sure to use your complete names; no nick names!). You will not get any points for the assignment if the initial comments are missing! Test your application.  

2) Create csc60/Repository directory in your home directory (i.e, mkdir ~/csc60/Repository), initialize it to be cvs repository, and import your shell project directory (remember, you have to be in your shell directory when issuing cvs import command). Then, change to ~/csc60/a3 subdirectory and checkout your shell module. Your remaining work will be done in this newly checked-out shell subdirectory (cd ~/csc60/a3/shell). 

3) In the shell directory create src, inc, and obj subdirectories. Run make clean command to remove all object and executable files and then move all the .c files to the src subdirectory, and all the .h files to the inc subdirectory. Keep your Makefile in the shell directory. Modify your Makefile so that all .o files are created in the obj subdirectory, but your application, sshell, is still created in the shell directory. Both make run and make clean command should work with this new arrangement.  And, of course, make command should recreate your application in the shell directory. As you are progressing with the assignment, occasionally run make clean command to remove all object and executable files, and use cvs commit command to commit your changes.  And remember to use cvs add command to add all newly created directories and files, and cvs delete to remove all files you are moving to other subdirectories. Test your application. 

 4) Modify the sshell prompt to reflect your initials, for example, Jane Doe, would change it to jdsh$ by modifying printf("\n$ ");  lines in sshell.c.  Additionally, look into the C source files and find at minimum 5 places where a system or library call is made and the error checking is not done.  Fix the code to test for errors reported by the system call or library routine, and in case of error print an error message and exit the application. When you are done with step 4), run make clean command to remove all object and executable files,  and use cvs commit command to commit your changes as revision 2.1

 Now, anticipating substantial changes to the code, you decide to put appropriate modules in their own libraries in the next two steps. The libraries will be in the new subdirectory, named lib, of the shell directory. You need to add this directory to your cvs shell project.

 Note: When you check out the latest version of your project, a complete directory structure, including the empty subdirectories, is retrieved. However, when you check out any revision, only non-empty subdirectories are retrieved. You can fix that problem by adding a non-empty text file to each potentially empty subdirectory, like obj, and committing it to the repository; or you can modify your Makefile to check for missing subdirectories, like obj, and create them before they are needed.

 5) Functions from parser.c and shutil.c, will be placed in static libraries libparser.a and libshell.a, respectively. Modify your Makefile to take care of the new directory structure; to create required libraries; and to re-create sshell application using these libraries. Also, modify your Makefile's clean target so it deletes the library files, in addition to the object and executable files.  Test your application. Note that you cannot use parser.o object file directly, nor libparser.a library file when creating executable file for your sshell application. You have to use -L and -l flags of gcc command, i.e., you have to tell the linker where your library is. (The same goes for the remaining libraries.)

Just to be safe, copy your Makefile to a file called static_libraries; keep static_libraries in the shell directory; add static_libraries to your cvs shell project; and then commit your changes as revision 3.1 (of course, after removing all object files, library files, and the executable. Also, don't forget to use command: cvs update

-A after you created revision 2.1 and before committing anything to your repository)

You can built your application by using the following command: make -f static_libraries Be sure to issue make -f static_libraries clean after you complete step 5) and before you start with step 6).

 6) In this step, the functions from parser.c and shutil.c will be placed in shared objects, dynamic libraries libparser.so and libshell.so, respectively. Modify your Makefile to create required libraries and to re-create sshell application using these libraries. Also, modify your Makefile's clean target so it deletes the library files, in addition to the object and executable files.  You will need to modify your Makefile's target run to allow executing sshell application (Notice: You have to set LD_LIBRARY_PATH environment variable). Test your application.

Note that you cannot use parser.o object file directly, nor libparser. so library file

When creating executable file for your sshell application. You have to use -L and -l flags of gcc command, i.e., you have to tell the linker where your library is. (The same goes for the remaining libraries.)

Just to be safe, copy your Makefile to a file called dynamic_libraries; keep dynamic_libraries in the shell directory; add dynamic_libraries to your cvs shell project; and then commit your changes as revision 4.1 (of course, after removing all object files, library files, and the executable. Also, don't forget to use command: cvs update -A after you created revision 3.1 and before committing anything to your repository). You can built your application by using the following command: make -f dynamic_libraries Be sure to issue make -f dynamic_libraries clean after you complete step 6).   

When you are done with the assignment run make clean command to remove all object, executable, and library files. Then change to your home directory and issue

the following command:    

tar czf  Your_name_a3.tar.z  csc60

Where, Your_name is replaced with your Last_First name. Submit Your_name_a3.tar.z to your SacCT account for CSC 60 class by the midnight of the due date. Late assignments will not be accepted!


Related Discussions:- Adding new features to a simple shell implementation

Advantages of java stored procedures, Advantages of java stored procedures ...

Advantages of java stored procedures Transactions Although a saved process contains SQL orders, once collected it will socialize with SQL Hosting server very diversely from

Visual basic 2010, I have to create a calorie counter and I am totally lost...

I have to create a calorie counter and I am totally lost

Write a program that lets the user play an adventure game, Let the player (...

Let the player (denoted U in the diagram below) navigate around the board until she wins the game by finding the exit or is killed by a monster. A player begins the game with a sli

Advantages of asp.net mvc framework, Advantages of asp.net mvc framework ...

Advantages of asp.net mvc framework MVC is a conventional style design that many designers are acquainted with. Some kinds of Web programs will advantage from the MVC structur

Write a program to perform an arithmetic operation, Write a program (calcul...

Write a program (calculation.ccp) to allow the user to perform an arithmetic operation on the two complex numbers entered.  The user can key in one of the four operations: addition

Explain the use of sync and fsck, Problem 1 Define the architecture of ...

Problem 1 Define the architecture of UNIX operating system with appropriate diagram Problem 2 Define the term inter-process communication. What are several approaches t

Systems of differential equations, In this section we need to take a brief ...

In this section we need to take a brief look at systems of differential equations which are larger than 2 x 2. The problem now is not like the first few sections where we looked at

C++, You are to write a program which will answer a pair of questions for s...

You are to write a program which will answer a pair of questions for squares, triangles, circles and ellipses. A square is defined by its lower left corner (SLLx,SLLy), and the len

Fortran source code, For this programming assignment, you are to develop a ...

For this programming assignment, you are to develop a Fortran 90/95/2003 program to automate a useful task. The aim of the assignment is for you to reveal your competence in the Fo

Unix, 1. Write a shell script to locate executable files. This script takes...

1. Write a shell script to locate executable files. This script takes a list of file names from the command line and determines which would be executed had these names been given a

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd