Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

Reading Commands

Description

Unformatted Attachment Preview

Suffolk University
Spring 2023
Math & CS Department
Reading Commands
In this assignment, you are to implement and test functions char
*wish_read_line(FILE *in) and int wish_read_config(char *fname). The
necessary constants are defined in the file wish.h (provided).
Function char *wish_read_line(FILE *in) shall read up to
WISH_MAX_INPUT characters from the previously opened file in. The
newline character, if any, shall be removed from the line. The
function shall allocate enough memory to store the input as a NULLterminated character string and return a pointer to the buffer. If
any I/O or memory operation fails, the function shall print an error
message with perror() and return NULL. If the input is longer than
WISH_MAX_INPUT, the function shall discard it (to the next newline,
including the newline itself), return NULL, and display the following
error message to stderr:
wish: line too long
If the line is blank (empty or consists only of white spaces, as
defined by isspace()), the function shall return NULL.
You are encouraged to use the library function getline() to implement
wish_read_line() but may choose to resort to fgets().
Function int wish_read_config(char *fname, int ok_if_missing) shall
read all lines from the file fname using the function wish_read_line.
The function is responsible for opening and closing the file and
reporting any errors associated with opening or closing the file
using perror(). However, if the file does not exist and the parameter
ok_if_missing is 1, the function shall do nothing (in particular, not
report an error). The function shall return 0 in case of success and
1 in case of failure.
Write function int main(int argc, char *argv[]) that shall read the
commands from the previously created file wish.conf (provided)
located in the $HOME directory1. The program then shall display the
prompt WISH_DEFAULT_PROMPT and read a command from stdin using
wish_read_line. The program shall then free all previously allocated
memory. The program shall successfully terminate by returning
EXIT_SUCCESS. If any of the involved functions fails, the program
shall return EXIT_FAILURE.
The main function shall be implemented in the file wish.c (provided).
The other two functions shall be implemented in the file wish_read.c
(provided). The files must include wish.h.
1
Function getenv() reads the value of a shell variable, such as $HOME.
Operating systems
Shell project
CMPSC-F355
Suffolk University
Spring 2023
Math & CS Department
The project must have a Makefile (provided) with all the necessary
dependencies. I will build your project (and you should, too) by
running make without any parameters. If I run make again without
modifying the submitted files, the project should not be rebuilt.
When I type make clean, the files that can be rebuilt (e.g., wish,
wish.o, and wish_read.o) shall be deleted. Those files should not be
placed under version control.
Operating systems
Shell project
CMPSC-F355

Purchase answer to see full
attachment
Explanation & Answer:

Worksheet

User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20