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
What are career values
NikAS [45]

Answer:hdhfnrjrjkejd

Explanation:

4 0
3 years ago
What kind of software consists of programs designed to make users more productive and/or assist them with personal tasks?
Sunny_sXe [5.5K]
It is application software
6 0
3 years ago
In what domain electrica energy is the most use
amm1812

Answer:the main signal bearing entities are voltage and their current in circuit environments.

Explanation:

5 0
3 years ago
List any two features of this computer
zaharov [31]

Answer:

John Mauchy 1. designed to be a stored-program computer 2. it was binary rather than decimal

3 0
3 years ago
What is the best method for collecting information from a source?
hichkok12 [17]
I personally think that summarizing important points is the way to go!
6 0
3 years ago
Other questions:
  • Radiation requires a heated liquid to transfer energy. Please select the best answer from the choices provided T F
    10·2 answers
  • A ________ is hardware or software that acts as a filter to prevent unwanted packets from entering a network.
    9·2 answers
  • Complete the paragraph to explain how Angelina can notify readers that her report is just a draft.
    6·1 answer
  • Write a program that finds the largest in a series of numbers entered by the user.The program must prompt the user to enter numb
    12·1 answer
  • What is the printout (display) of the following program? public class Test { public static void main(String[] args) { int[][] va
    9·1 answer
  • What is a googleplex?
    7·1 answer
  • Which of the following, (1) money deposited in a bank account, (2) student recording her answer to a question in an online test,
    9·1 answer
  • What specific record type is found in every zone and contains information that identifies the server primarily responsible for t
    10·1 answer
  • To maintain your body temperature, your body converts chemical potential energy into thermal energy T or F
    6·1 answer
  • Write a lottery program that will ask the user if they would like to pick 5 numbers (1-30) or if they would like to choose EZ Pi
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!