1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anestetic [448]
3 years ago
9

Before your shell forks a new process to call execvp(), it should parse the input string and separate it into a collection of su

bstrings representing the executable file and any command-line arguments. If the user entered an empty line, report an error and fetch a new line of input. Your code must handle at least four command-line arguments (in addition to the name of the executable file itself).
Computers and Technology
1 answer:
kompoz [17]3 years ago
3 0

Answer:

#define LSH_RL_BUFSIZE 1024

char *lsh_read_line(void)

{

int bufsize = LSH_RL_BUFSIZE;

int position = 0;

char buffer = malloc(sizeof(char) bufsize);

int c;

if (!buffer) {

   fprintf(stderr, "lsh: allocation error\n");

   exit(EXIT_FAILURE);

}

while (1) {

   // Read a character

   c = getchar();

   // If we hit EOF, replace it with a null character and return.

   if (c == EOF || c == '\n') {

     buffer[position] = '\0';

     return buffer;

   } else {

     buffer[position] = c;

   }

   position++;

   // If we have exceeded the buffer, reallocate.

   if (position >= bufsize) {

     bufsize += LSH_RL_BUFSIZE;

     buffer = realloc(buffer, bufsize);

     if (!buffer) {

       fprintf(stderr, "lsh: allocation error\n");

       exit(EXIT_FAILURE);

     }

   }

}

}

Explanation:

You might be interested in
List out any four hardware and software components required for multimedia​
natta225 [31]

Answer:

The list of hardware components required in multimedia are as follows:

  • Microprocessor.
  • High storage hard disk.
  • RAM.
  • High resolution graphics cards.

The list of software components required in multimedia are as follows:

  • Text
  • Audio
  • Graphics
  • Video
3 0
3 years ago
Editing and sorting the data file are steps performed during the ________ stage in the data processing cycle
yawa3891 [41]
<span>Editing and sorting the data file are steps performed during the data preparation stage in the data processing cycle.</span>
5 0
3 years ago
When an item is gray that means...
solong [7]

Answer:

B. The item has been selected

8 0
3 years ago
Read 2 more answers
Select the best answer to the following question.
Fittoniya [83]

Answer:

I think its called "cloud computing"

8 0
3 years ago
Which of the following is 1000 of a second​
s344n2d4d5 [400]

Answer:

what I don't understand your question

6 0
4 years ago
Other questions:
  • Given the following word addresses: 3, 180, 43, 2, 191, 88, 190, 14, 181, 44, 186, 253a.Show the final cache contents for a thre
    12·1 answer
  • Write an application program that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the o
    5·1 answer
  • Which key removes all data from an active cell with one click? A. Esc B. Delete C. Tab D. F2
    9·2 answers
  • When would you use a template when working with word 2013?
    15·1 answer
  • How many suggestions available in correcting misspelled words<br>​
    11·1 answer
  • What memory stores instructions that tell the computer how to start up?
    10·1 answer
  • Solid state components are less likely to fail because they:______.a. are driven by precise sets of software instructions. b. ha
    8·1 answer
  • What are cell phones used for?
    8·2 answers
  • What is the empty space inside the character 'O' called?
    12·1 answer
  • Consider the key success factors of B2C. Is it only IT? What is most important?​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!