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 an application that opens and analyses word files, Design an applica...

Design an application that opens and analyses word files. Requirements: Create an application that analyses text documents. It should open a text file, read each word in

Abstraction hierarchy of mechanisms, Abstraction hierarchy of mechanisms ...

Abstraction hierarchy of mechanisms Given  the light-sensitive the motor and resistor,  we could  find  several  ways  of interconnecting them, using bits of ceramic and metal

Visual basic.net, how to create a screen for messages for a data transmissi...

how to create a screen for messages for a data transmission system

Network security, Term project (you should code a function), demonstrate it...

Term project (you should code a function), demonstrate it to the class and a very breief report (one or two pages) describing what you did. You determine your project (could be imp

Program to create multithreaded calculator, Multithreaded Calculator I...

Multithreaded Calculator In this Lab, you will be implementing a simple multithreaded calculator. Our calculator will accept expressions as infix notation text strings consist

Outline the norms to be designing a web page, Question: (a) Outline th...

Question: (a) Outline the six norms to be considered before designing a Web page. (b) Write a program such that when a user right-clicks anywhere on a Web page, the follow

Program for simulate part of the game of yahtzee, This assignment will make...

This assignment will make use of arrays and functions to simulate a game. ASSIGNMENT DESCRIPTION This program will simulate part of the game of Yahtzee! The player will

Just in time compiler, Expertsmind brings you  unique  solution in java as...

Expertsmind brings you  unique  solution in java assignments Just in Time Compiler In processing, just-in-time system (JIT), also known as energetic interpretation, is a m

Lalr parser - xml table output, LALR Parser: Rule Table - Contains de...

LALR Parser: Rule Table - Contains definitions of production rules within the grammar. Attributes: Count - Number of production rules in the table Child items:

HTML Form/JavaScript, I have a problem which seems to be quite a rare one a...

I have a problem which seems to be quite a rare one and I can safely say I know what exactly what is causing it. After some process of elimination I reached the conclusion that, in

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