Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C- how would i go about starting this code? a. [0/-5/-10 ] Sound and Secure Cyber Design You shall minimize the use of global variables

C- how would i go about starting this code? image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
a. [0/-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. Your program will not be compiled using the -d compiler directive. Source code is insufficiently documented: complex code blocks not 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 Least Privilege. b. [5/_/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 line after the last command line argument. 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 I/O routines for reporting errors. Output error messages to standard error. d. [5/_/0] 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 I/O routines for this feature. After you output the usage message, exit the program with a normal return value. e. [5/_/0] Part 1 - Single Filename From Command Line (myCat) Read in a single filename from the command line. Using Descriptor I/O 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 Read in a single filename from the command line. Using Descriptor I/O 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; i.e. do not write all your code directly in main(). If you are unable to read data from the file output an error message, and return a unique error number f. [5/_/0] Part 2 - Multiple Filenames From Command Line (myCat) Read in multiple filenames from the command line. Using Descriptor I/O read the sequence of bytes, from the beginning of the sequence to the end of the sequence, associated with each file named on the command line and output the contents of each file to standard output. Output the contents of the specified files in the order specified on the command line. For example: $ myCat filel file2; would first output the contents of filel, followed by the contents of file to standard output. Implement at least the reading and writing steps as a function your program calls 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. [5/__/0] 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. [07-10 ] Code Compilation and Running a. [0/-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. Your program will not be compiled using the -d compiler directive. Source code is insufficiently documented: complex code blocks not 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 Least Privilege. b. [5/_/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 line after the last command line argument. 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 I/O routines for reporting errors. Output error messages to standard error. d. [5/_/0] 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 I/O routines for this feature. After you output the usage message, exit the program with a normal return value. e. [5/_/0] Part 1 - Single Filename From Command Line (myCat) Read in a single filename from the command line. Using Descriptor I/O 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 Read in a single filename from the command line. Using Descriptor I/O 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; i.e. do not write all your code directly in main(). If you are unable to read data from the file output an error message, and return a unique error number f. [5/_/0] Part 2 - Multiple Filenames From Command Line (myCat) Read in multiple filenames from the command line. Using Descriptor I/O read the sequence of bytes, from the beginning of the sequence to the end of the sequence, associated with each file named on the command line and output the contents of each file to standard output. Output the contents of the specified files in the order specified on the command line. For example: $ myCat filel file2; would first output the contents of filel, followed by the contents of file to standard output. Implement at least the reading and writing steps as a function your program calls 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. [5/__/0] 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. [07-10 ] Code Compilation and Running

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

For the company Best Buy Inc Co. provide aPESTAL analysis.

Answered: 1 week ago