Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

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!

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9526137

Have any Question?


Related Questions in Programming Language

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As