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

Design and implement instantiable classes, Overview Goals: The goals for...

Overview Goals: The goals for this assignment are Design and implement instantiable classes. Use arrays of objects. Read from and write to files. Implement basic

.net class library, .NET class library .NET structure comes with just on...

.NET class library .NET structure comes with just one category selection. And that all developers need to learn!! Whether they create the value in C# or VB.NET or J#, it doesn't

Sytem call, use of exec and nice system call

use of exec and nice system call

C++ programing, how to rewrite C++ program the DNAStrand class (DNA Project...

how to rewrite C++ program the DNAStrand class (DNA Project) to instead store the nucleotide sequence in a dynamically-allocated array?

We are looking for on-call developers, Pre-order integration on Shopify sto...

Pre-order integration on Shopify store We are looking for on-call developers who can integrate Celery on client Shopify stores. Requirements a) Contented editing Shopify them

Design and construct a basic math program, For this assignment you will nee...

For this assignment you will need to design and construct a basic math program which targets elementary school children. Your program must adhere to the following steps and require

Develop an application for airraid game, Extend the AirRaid game, so that t...

Extend the AirRaid game, so that the planes drop a bomb on the gun as they go over it. The gun has to move out of the way otherwise it will be destroyed if hit. Provide three lives

C# xna game project, I need to finish my game project within two weeks usin...

I need to finish my game project within two weeks using XNA. Would you guys can help me to finish it? Thank you

develop a web page via href attribute, 1.  Develop a Web page via href att...

1.  Develop a Web page via href attribute of anchor tag and the attribute: vlink, alink, etc. 2.  Develop a Web page, in which when the user clicks on the link it will go to the

Higher order differential equations, We'll start this section off with the ...

We'll start this section off with the material which most text books that will cover in this section. We will take the matter from the Second Order chapter and expand this out to n

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