Answered step by step
Verified Expert Solution
Question
1 Approved Answer
thats all the information i have be specific what information you need me to provide b. [57_70] Based on your block diagram, write pseudo code
thats all the information i have be specific what information you need me to provide
b. [57_70] Based on your block diagram, write pseudo code for the main function in your mycat program. Write the pseudo code in myCat-pseudo.c. Include a comment that clearly indicates your pseudo code labeled Paragraph 3.b. Note: Your pseudo code will not be compiled, you do not need to write your pseudo code such that it compiles. Your pseudo code shall not match your final solution code. Go through the problem solving process for programming Hint: Comments are your friend. c. [57_70] Write pseudo code that uses Descriptor 1/0 to read the contents of a single file and outputs the contents of the file to standard output (see myCat Part 1). Write the pseudo code in mycat-pseudo.c. Include a comment that clearly indicates your pseudo code labeled Paragraph 3.c. d. [57_70] Write pscudo code that iterates through all of the files named on the command line and makes use of the routine from Paragraph 3.c. to output the contents of the files in order to standard output (see myCat Part 2). Write the pseudo code in myCat-pseudo.c. Include a comment that clearly indicates your pseudo code labeled Paragraph 3.d. 4. Implement ( 30 ). . . . . a 10/-5/-10 ) Sound and Secure Cyber Design You shall minimize the use of global variables other than errno, and for error reporting You are encouraged to use #define and other preprocessing directives. o Your program will not be compiled using the -D compiler directive. Source code is insufficiently documented complex code blocks hot explained, lack of robust program and function descriptions (readability). Source code is poorly or inconsistently formatted, but can be compiled (readability). Source code uses poorly named variables, or functions (readability). Source code does not use associated common libraries (reusability). Source code does not use library defined constants (portability). Source code does not use deprecated language features (design for the future) Implementation does not violate Principle of Last Privilege b. 15/__/0] myEcho Read in arguments from the command line. Use Descriptor I/O to output the command line arguments to standard output, output a single space character between and only between command line arguments Output a trailing new linc after the last command line argument. . . . . . . SY204 - Sys Prgm & OS Fund Name(s) Alpha(s) c. [51_10] Error Handling (eyecho, myCat) For an error that occurs from a system call, output a simple error message, and exit the program (except as discussed specifically below) returning an error number. At least return a different error number for each of the system calls that you use. That is, multiple calls to the same system call do not need to return unique error numbers, but calls to different system calls shall return unique error numbers. You may use C Library 10 routines for reporting errors. Output error messages to standard error d. [51_70) Usage Option (myCat) Read in the "h" (help) option using getopt, that does not take any arguments Upon detection of the "h" option display simple usage information that describes how to use your program (usage message). Example program name, listing and discussion of command line arguments You may assume that all options will appear before arguments. You may use C Library O routines for this feature. After you output the usage message, exit the program with a normal return value. . 15__/0] Part 1 - Single Filename From Command Line (myCat) Read in a single filename from the command line. Using Descriptor 10 read the sequence of bytes, from the beginning of the sequence to the end of the sequence, associated with the file named on the command line and output the contents of the file to standard output Implement at least the reading and writing steps as a function your program calls, ie, do not write all your code directly in maino If you are unable to read data from the file output an error message, and return a unique Tror number [5/__/01 Part 2 - Multiple Filename: From Command Line (nycat) Read in multiple filenames from the command line Using Descriptor 10 read the sequence of bytes from the beginning of the sequence the end of the sequence, associated with each file named on the commund time and output the contents of each file to standard Output the contents of the specified files in the onder specified on the command line for example 5 mycat file file first output the contents of filel, followed by the contents of file to standard output Implement allows the reading and writing as a function your program calls . . SY204 - Sys Prgm & OS Fund Name(s): Alpha(s): . If you are unable to access a file for reading output an error message, but continue processing the rest of the command line arguments, and return a unique error number after processing all of the command line arguments. g. [57270] Part 3 - Standard Input From Command Line (myCat) For any filename specified via the command line, if the filename is a single hyphen ( - ). then read input from standard input and output the input to standard output until the EOF (Ctrl-d) is entered If you are unable to access a file for reading output an error message, but continue processing the rest of the command line arguments, and return a unique error number after processing all of the command line arguments. . 2 Alpha(8) If you are unable to access a file for reading output an error message, but continue processing the rest of the command line arguments, and return a unique error number after processing all of the command line arguments. & [5/_/01 Part 3 - Standard Input From Command Line (myCat) . For any filename specified via the command line, if the filename is a single hyphen ( - ), then read input from standard input and output the input to standard output until the EOF (Ctrl-d) is entered If you are unable to access a file for reading output an error message, but continue processing the rest of the command line arguments, and return a unique error number after processing all of the command line arguments. 5. Test ( 25 ) . . . a. [0/-10] Code Compilation and Running Source code compiles (gcc-Wall ...) under Ubuntu 18.04 LTS x86-64 with no warnings and no errors. Compiled program runs without crushing on test cases (no SEGFAULTs, no infiniem loops) b. [5/_/01 myEcho Solution correctly outputs command line arguments to standard output. Solution correctly outputs a single space between and only between command line arguments. Solution correctly outputs a trailing new line after the last command line argument. c. [37__70Error Handling (myEcho, mycat) Solution correctly outputs error messages to standard error Solution correctly returns unique values for different system calls d. [2/__/01 Usage Option (myCat) Solution correctly outputs a usage message Solution correctly returns a normal exit value . 13-0) Part 1 Single Filename From Command Line (myCat) Solution correctly outputs the contents of the file to standard output . ALAME 5 . -Y204 - Sys Prgm & OS Fund Name(s): Alpha(s): f. [5/__/0] Part 2 - Multiple Filenames From Command Line (mycat) Solution correctly outputs the contents of the files in order to standard output. g. [5/_70] Part 3 - Standard Input From Command Line (myCat) Solution correctly outputs data read from standard input. Submit Turn in this worksheet and submit source code per the following specifications. Turn in this worksheet to your instructor after you have submitted your final source code. Submit your pseudo code as a single file named mycat-pseudo.c, following the submission directions on the course information web page. Submit your source code in two files one named myEcho.c, the other named mycat-#.c, where # is the part of the implementation that you completed (e.g. myCat-3.c), following the submission directions on the course information web page. Submit both myEcho.c and myCat-#.c as a part of the same submission; i.e. submit two files from a single run of submit. If you resubmit one of the files, then resubmit both of the files. submit Assignment (project): lab02 07-107-15/-20 ] Submitted source code that demonstrated insufficient effort (lack of attempt to solve problem) 0/-51 Submitted assignment using incorrect assignment type or incorrect assignment number 07-51 Submitted incorrect number of files in submission 07-51 Submitted file(s) named incorrectly. 07-5] Submitted file(s) do not include name and alpha. 1. General ( 5 ) See assignment webpage for due dates. a. Description. Read through this entire assignment before starting work. In this assignment you will create a simple version of the echo, and cat utilities using command line arguments and Descriptor I/O. Your version of cat will take in options and arguments from the command line. The length of the command line and the sizes of the files specified via the command line will be an arbitrary length. b. [57_70] Based on your block diagram, write pseudo code for the main function in your mycat program. Write the pseudo code in myCat-pseudo.c. Include a comment that clearly indicates your pseudo code labeled Paragraph 3.b. Note: Your pseudo code will not be compiled, you do not need to write your pseudo code such that it compiles. Your pseudo code shall not match your final solution code. Go through the problem solving process for programming Hint: Comments are your friend. c. [57_70] Write pseudo code that uses Descriptor 1/0 to read the contents of a single file and outputs the contents of the file to standard output (see myCat Part 1). Write the pseudo code in mycat-pseudo.c. Include a comment that clearly indicates your pseudo code labeled Paragraph 3.c. d. [57_70] Write pscudo code that iterates through all of the files named on the command line and makes use of the routine from Paragraph 3.c. to output the contents of the files in order to standard output (see myCat Part 2). Write the pseudo code in myCat-pseudo.c. Include a comment that clearly indicates your pseudo code labeled Paragraph 3.d. 4. Implement ( 30 ). . . . . a 10/-5/-10 ) Sound and Secure Cyber Design You shall minimize the use of global variables other than errno, and for error reporting You are encouraged to use #define and other preprocessing directives. o Your program will not be compiled using the -D compiler directive. Source code is insufficiently documented complex code blocks hot explained, lack of robust program and function descriptions (readability). Source code is poorly or inconsistently formatted, but can be compiled (readability). Source code uses poorly named variables, or functions (readability). Source code does not use associated common libraries (reusability). Source code does not use library defined constants (portability). Source code does not use deprecated language features (design for the future) Implementation does not violate Principle of Last Privilege b. 15/__/0] myEcho Read in arguments from the command line. Use Descriptor I/O to output the command line arguments to standard output, output a single space character between and only between command line arguments Output a trailing new linc after the last command line argument. . . . . . . SY204 - Sys Prgm & OS Fund Name(s) Alpha(s) c. [51_10] Error Handling (eyecho, myCat) For an error that occurs from a system call, output a simple error message, and exit the program (except as discussed specifically below) returning an error number. At least return a different error number for each of the system calls that you use. That is, multiple calls to the same system call do not need to return unique error numbers, but calls to different system calls shall return unique error numbers. You may use C Library 10 routines for reporting errors. Output error messages to standard error d. [51_70) Usage Option (myCat) Read in the "h" (help) option using getopt, that does not take any arguments Upon detection of the "h" option display simple usage information that describes how to use your program (usage message). Example program name, listing and discussion of command line arguments You may assume that all options will appear before arguments. You may use C Library O routines for this feature. After you output the usage message, exit the program with a normal return value. . 15__/0] Part 1 - Single Filename From Command Line (myCat) Read in a single filename from the command line. Using Descriptor 10 read the sequence of bytes, from the beginning of the sequence to the end of the sequence, associated with the file named on the command line and output the contents of the file to standard output Implement at least the reading and writing steps as a function your program calls, ie, do not write all your code directly in maino If you are unable to read data from the file output an error message, and return a unique Tror number [5/__/01 Part 2 - Multiple Filename: From Command Line (nycat) Read in multiple filenames from the command line Using Descriptor 10 read the sequence of bytes from the beginning of the sequence the end of the sequence, associated with each file named on the commund time and output the contents of each file to standard Output the contents of the specified files in the onder specified on the command line for example 5 mycat file file first output the contents of filel, followed by the contents of file to standard output Implement allows the reading and writing as a function your program calls . . SY204 - Sys Prgm & OS Fund Name(s): Alpha(s): . If you are unable to access a file for reading output an error message, but continue processing the rest of the command line arguments, and return a unique error number after processing all of the command line arguments. g. [57270] Part 3 - Standard Input From Command Line (myCat) For any filename specified via the command line, if the filename is a single hyphen ( - ). then read input from standard input and output the input to standard output until the EOF (Ctrl-d) is entered If you are unable to access a file for reading output an error message, but continue processing the rest of the command line arguments, and return a unique error number after processing all of the command line arguments. . 2 Alpha(8) If you are unable to access a file for reading output an error message, but continue processing the rest of the command line arguments, and return a unique error number after processing all of the command line arguments. & [5/_/01 Part 3 - Standard Input From Command Line (myCat) . For any filename specified via the command line, if the filename is a single hyphen ( - ), then read input from standard input and output the input to standard output until the EOF (Ctrl-d) is entered If you are unable to access a file for reading output an error message, but continue processing the rest of the command line arguments, and return a unique error number after processing all of the command line arguments. 5. Test ( 25 ) . . . a. [0/-10] Code Compilation and Running Source code compiles (gcc-Wall ...) under Ubuntu 18.04 LTS x86-64 with no warnings and no errors. Compiled program runs without crushing on test cases (no SEGFAULTs, no infiniem loops) b. [5/_/01 myEcho Solution correctly outputs command line arguments to standard output. Solution correctly outputs a single space between and only between command line arguments. Solution correctly outputs a trailing new line after the last command line argument. c. [37__70Error Handling (myEcho, mycat) Solution correctly outputs error messages to standard error Solution correctly returns unique values for different system calls d. [2/__/01 Usage Option (myCat) Solution correctly outputs a usage message Solution correctly returns a normal exit value . 13-0) Part 1 Single Filename From Command Line (myCat) Solution correctly outputs the contents of the file to standard output . ALAME 5 . -Y204 - Sys Prgm & OS Fund Name(s): Alpha(s): f. [5/__/0] Part 2 - Multiple Filenames From Command Line (mycat) Solution correctly outputs the contents of the files in order to standard output. g. [5/_70] Part 3 - Standard Input From Command Line (myCat) Solution correctly outputs data read from standard input. Submit Turn in this worksheet and submit source code per the following specifications. Turn in this worksheet to your instructor after you have submitted your final source code. Submit your pseudo code as a single file named mycat-pseudo.c, following the submission directions on the course information web page. Submit your source code in two files one named myEcho.c, the other named mycat-#.c, where # is the part of the implementation that you completed (e.g. myCat-3.c), following the submission directions on the course information web page. Submit both myEcho.c and myCat-#.c as a part of the same submission; i.e. submit two files from a single run of submit. If you resubmit one of the files, then resubmit both of the files. submit Assignment (project): lab02 07-107-15/-20 ] Submitted source code that demonstrated insufficient effort (lack of attempt to solve problem) 0/-51 Submitted assignment using incorrect assignment type or incorrect assignment number 07-51 Submitted incorrect number of files in submission 07-51 Submitted file(s) named incorrectly. 07-5] Submitted file(s) do not include name and alpha. 1. General ( 5 ) See assignment webpage for due dates. a. Description. Read through this entire assignment before starting work. In this assignment you will create a simple version of the echo, and cat utilities using command line arguments and Descriptor I/O. Your version of cat will take in options and arguments from the command line. The length of the command line and the sizes of the files specified via the command line will be an arbitrary length Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started