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...
-
A simple beam of rectangular cross section has span length L = 62 in. and supports a concentrated moment M = 560 k-in at midspan (see figure). The height of the beam is h = 6 in. and the width is b =...
-
Use the data given in PB13-1 for Tiger Audio. Refer to PB13-1, The comparative financial statements prepared at December 31, 2014, for Tiger Audio showed the following summarized data: Required 1....
-
Consider the model \(y_{i}=\beta_{1} x_{i}+\varepsilon_{i}\), that is, regression with one explanatory variable without the intercept term. This model is called regression through the origin because...
-
Suppose your companys method of making decisions under risk is making the best out of the worst possible outcome. What rule would you be forced to follow?
-
Marketing Analytics 6.1 The Expanding Uses of Data Mining and Analytics in the Restaurant Industry** When Damian Mogavero, a restaurant group CFO, realized the vast need for improved data analytics...
-
Refer to Figure 2-30 and the discussion about updating master files from transaction files. The discussion presents the record structures for a sales transaction. Prepare a diagram (similar to Figure...
-
9. In 2016, Olives Optometry, a sole proprietorship, purchased a piece of business-use property (Equipment A) for $1,000,000. Olives owned Equipment A for more than a year and depreciation deductions...
-
Explain the differences and similarities between processes and threads. How are they similar? What differentiates them?
-
In a process using threads, is there one stack per thread, or one stack per process? Explain.
-
C alculate the linear Velocity at which a cyclist displaces if its tires have 9 0 cm of diameter and give 3 6 turn every 1 0 s .
-
A combustion chamber is sometimes designed to keep pressure constant along its length. This is done by varying cross-sectional area as heat is added. For a case where the heat added per mass of the...
-
List and detail the hardware and software requirements for a failover cluster. (Windows Server 2016)
-
Write a SQL query to retrieve the names of employees who earn the highest salary in a table.
-
What is the difference between direct materials and indirect materials?
-
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...
-
Using the potential theory obtain the damping for a cycle of (i) plunge, (ii) pitch oscillations.
-
Obtain the vortex lift line slope, given by Eq. 8.14, for a supersonic delta wing. Eq. 8.14 Ky = -(cos A) ?
-
The state-space representation is based on a state function \(x\) satisfying the first order ODE \(\tau_{1} \dot{x}=x_{o}\left(\alpha-\tau_{2} \dot{\alpha} ight)-x\), where argument...
Study smarter with the SolutionInn App