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

Cobol program, need someone to write a simple cobol program for me..urgent

need someone to write a simple cobol program for me..urgent

Miranda, Hi, Can you do exercises: D2, D3, D4, and D5 on page 230 of the fo...

Hi, Can you do exercises: D2, D3, D4, and D5 on page 230 of the following book: http://www.daimi.au.dk/~bra8130/Wiley_book/wiley.html . The book can be downloaded for free from t

C language, write a program to find the output 1 ...

write a program to find the output 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 2 1 1 2 1 1

Pattern matching program in xhtml, Part 1 Given the following Regular Exp...

Part 1 Given the following Regular Expressions, explain in detail the pattern accepted by each. Pay attention to all the characters being used. Your answers need not appear with

Shell script to print multiplication table of given number, Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Example problem of modularity, Example problem Imagine that  you  requ...

Example problem Imagine that  you  require  to create  a robot  that  will  roll up  close to a light  lamp  and  stop  a fixed distance from it.  The first question is, how w

Help with c assignment, You will design and implement a program that will •...

You will design and implement a program that will • analyse the various characteristics of a maze, represented by a particular coding of its basic con- stituents into numbers store

System calls, #questiWrite down different system calls for performing diffe...

#questiWrite down different system calls for performing different kinds of tasks.on..

Find the dual - duality theory and complementary slackness, Linear Programm...

Linear Programming Consider the following optimization problem: min x s.t. x ≥ max{a1, a2, . . . , an} Rewrite this problem as a Linear Programming Problem. What is the

Create a structure that will represent a deck of cards, We want to create a...

We want to create a structure that will represent a deck of cards  (not necessarily full). Each card has a character (between  '2'  to  '9' and  'T',  'J',  'Q',  'K',  'A') and 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