If the compiler complains that /tmp is full (No space left on device), then set your...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
If the compiler complains that /tmp is full ("No space left on device"), then set your TMPDIR environment variable to /scratch. You can do this in your bash shell and in your shell scripts like this TMPDIR=/scratch; export TMPDIR All editing must be done within the shell using a text editor. All work must be performed on cs l.utdallas.edu or cs2.utdallas.edu. No late homework is accepted. Example Output $> compile.sh Setting TEMPDIR environment variable to /scratch Compiling filel.cc Compiling filel2.cc Linking files to create executable hwl Done $> run.sh Running 'hwl' with 0 arguments: stdout appended to stdout.log stderr appended to stderr.log Running 'hwl' with 1 argument: stdout appended to stdout.log stderr appended to stderr.log Running 'hwl' with 5 arguments: stdout appended to stdout.log stderr appended to stderr.log Purpose Demonstrate the ability to use text editors in the shell. Demonstrate the ability to create and execute shell scripts. Demonstrate the ability to create and compile multi-file C+ programs. Demonstrate the ability to access the command line arguments from within a C+ program. Demonstrate proficiency in logging your console input/output using the script command. Assignment Log all the work you do in the bash shell using the script command (see the "Session Logging" section below). You will need to get logging working BEFORE you perform any of the steps listed below. You will need to turn in the session log files. See "Deliverables" below. With script logging on and working, write a program that consists of two C+ source files and a header file (.h file). The first C++ file contains the main() routine and the second file contains a C++ function. The function prototype should be included in the header file. From within main(), you must display the count of command line arguments to stdout. Further, you must display the value of each command line argument to stdout. Finally, you must call the procedure that is defined in the second file. From within the procedure defined in the second file, you must display a log message that states you are inside the procedure. This log message must be sent to stderr. You are then to create a shell script for compiling your code. The script will individually compile each file and generate the intermediate object file. Once the object files are created, the script will call the linker and link the object files into an executable. Your shell script should echo what it is doing at each step to stdout. $> more stdout.log argc was: 1 ./hwl Done! argc was: 2 ./hwl abc Done! argc was: 6 ./hwl a b Done! $> more stderr.log Inside procl () as stderr Inside procl () as stderr Inside procl () as stderr Session Logging Session logging will be performed using the Linux script command. For details, sce the man page for script (i.e. man script). Make sure that you are careful to NOT OVERWRITE any older script files you may have previously created. script will overwrite a file if you give it a file name that already exists. See the -a option to protect against this. You may exit the script program by typing: CTRL-D. You can either keep one long log file that spans multiple login sessions, or you can create multiple log files (or both). You are then to create a second shell script that will run your program several times with varying command line arguments. Each time you call your program, you should append the stdout to an output file called stdout.log and you should append the stderr to an output file called stderr.log. Your shell script should echo what it is doing at each step to stdout. If the compiler complains that /tmp is full ("No space left on device"), then set your TMPDIR environment variable to /scratch. You can do this in your bash shell and in your shell scripts like this TMPDIR=/scratch; export TMPDIR All editing must be done within the shell using a text editor. All work must be performed on cs l.utdallas.edu or cs2.utdallas.edu. No late homework is accepted. Example Output $> compile.sh Setting TEMPDIR environment variable to /scratch Compiling filel.cc Compiling filel2.cc Linking files to create executable hwl Done $> run.sh Running 'hwl' with 0 arguments: stdout appended to stdout.log stderr appended to stderr.log Running 'hwl' with 1 argument: stdout appended to stdout.log stderr appended to stderr.log Running 'hwl' with 5 arguments: stdout appended to stdout.log stderr appended to stderr.log Purpose Demonstrate the ability to use text editors in the shell. Demonstrate the ability to create and execute shell scripts. Demonstrate the ability to create and compile multi-file C+ programs. Demonstrate the ability to access the command line arguments from within a C+ program. Demonstrate proficiency in logging your console input/output using the script command. Assignment Log all the work you do in the bash shell using the script command (see the "Session Logging" section below). You will need to get logging working BEFORE you perform any of the steps listed below. You will need to turn in the session log files. See "Deliverables" below. With script logging on and working, write a program that consists of two C+ source files and a header file (.h file). The first C++ file contains the main() routine and the second file contains a C++ function. The function prototype should be included in the header file. From within main(), you must display the count of command line arguments to stdout. Further, you must display the value of each command line argument to stdout. Finally, you must call the procedure that is defined in the second file. From within the procedure defined in the second file, you must display a log message that states you are inside the procedure. This log message must be sent to stderr. You are then to create a shell script for compiling your code. The script will individually compile each file and generate the intermediate object file. Once the object files are created, the script will call the linker and link the object files into an executable. Your shell script should echo what it is doing at each step to stdout. $> more stdout.log argc was: 1 ./hwl Done! argc was: 2 ./hwl abc Done! argc was: 6 ./hwl a b Done! $> more stderr.log Inside procl () as stderr Inside procl () as stderr Inside procl () as stderr Session Logging Session logging will be performed using the Linux script command. For details, sce the man page for script (i.e. man script). Make sure that you are careful to NOT OVERWRITE any older script files you may have previously created. script will overwrite a file if you give it a file name that already exists. See the -a option to protect against this. You may exit the script program by typing: CTRL-D. You can either keep one long log file that spans multiple login sessions, or you can create multiple log files (or both). You are then to create a second shell script that will run your program several times with varying command line arguments. Each time you call your program, you should append the stdout to an output file called stdout.log and you should append the stderr to an output file called stderr.log. Your shell script should echo what it is doing at each step to stdout.
Expert Answer:
Related Book For
Managing Business Ethics Straight Talk about How to Do It Right
ISBN: 978-0470343944
5th edition
Authors: Linda klebe Trevino, Katherine A. Nelson
Posted Date:
Students also viewed these computer engineering questions
-
Calibration curve. You can do this exercise with your calculator, but it is more easily done by the spreadsheet in Figure 4-15. In the Bradford protein determination, the color of a dye changes from...
-
In early UNIX systems, executable files (a.out files) began with a very specific magic number, not one chosen at random. These files began with a header, followed by the text and data segments. Why...
-
The following total cost and inverse demand functions (in dollars) are given for a firm: 1 TC (q) = 9-q +39 and_p(q) = 84 - q. (a) For what value(s) of q is the profit maximized? What is the maximum...
-
1. Identify the function of the underlined noun/s in each item. 1. On rainy mornings, is your bus usually late? 2. On the desk were the red pencils. 3. Volcanoes and earthquakes are destructive...
-
Table 17-1 shows data on earnings, expenses, and assets for all insured banks. Calculate the annual growth rates in the various income, expense, earnings, and asset categories from 1991 to 2010. If...
-
The financial statements of Aritzia Inc. are presented in Appendix A at the end of this textbook. Instructions a. What title does Aritzia use for its income statement? What title does Aritzia use for...
-
Write up a two-column cash book from the following: 19X9 Nov 1 Balance brought forward from last month: Cash 105; Bank 2,164. 2 Cash sales 605. 55 3 55 35 35 23 35 2 25 " " " " 4 5 6 7 Took 500 out...
-
The income statement for Christiansen, Inc., appears below. Christiansen, Inc. Income Statement For the Year Ended December 31, 2014 Net sales ..............................$400,000 Cost of goods...
-
Unit Sales 8" x 10" 12" x 16" Frame Frame East 30,488 13,728 Central 7,171 5,586 West 6,240 4,738 Product and Area 8" x 10" Frame: East Central West Total Raphael Frame Company Sales Budget For the...
-
The paralegal is assigned the task of preparing an office legal memorandum. The memorandum is due in 10 days, and there is a 5-page limit. The facts and law are as follows: Facts: Mary was Tom's...
-
please send me answer. along Jea 3. The food revenue budget has been increased by 25%% with the implementation of a Tapas Menu. D. The Beverage Revenue budget has been increased 20% with the...
-
The company is looking to invest $800,000 for two addition lines for production.Our current ROI targets are at 15%.These two lines would then produce annual profits of $65,000 for each line.Do you...
-
1 . How would you calculate the loss of coastal land due to natural causes into your accounting books? 2 . how would this affect the property value of the house & land? 3 . is there any law or...
-
The Pandeys were looking at buying a new house in Surrey. Their bank used the 32% rule decided that they can afford a maximum monthly mortgage payment of $2,500. How large of a mortgage would the...
-
Fixed costs for manufacturing widgets are $25,000. Determine the fixed cost per unit when the quantity produced is (a) 5,000 and (b) 75,000.
-
The Pandeys just purchased a home in Burnaby for $1,500,000. They made a down payment of 20% and took out a mortgage with Westminster Savings Credit Union for the balance amortized over 25 years at...
-
Penguin Network Warehouse, LLC ("PNW, LLC") acquired thefollowing assets last year:Industrial Refrigeration Equipment on January 23Network server computer equipment on May 4Office furniture on Jun 0...
-
What are technical skills At what level are they most important and why?
-
Imagine that someone from another culture asked you to provide information about business ethics when dealing with American managers. What would you say?
-
Imagine that youre the CEO of a large firm like any of the ones described in this chapter. What concrete steps would you take to restore your companys reputation?
-
When other firms in your industry are behaving unethically, how can you buck the trend and position your company to value ethical behavior? Why is that important? Will it damage your companys...
-
Banks advertise to attract customers.
-
Discuss how you benefit when interest is compounded monthly as opposed to annually.
-
Identify the services offered by the different financial institutions.
Study smarter with the SolutionInn App