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
A vehicle fails an HC emission test at idle and 2,500 rpm, and the engine has an acceleration stumble. The heated oxygen sensor
Natalija [7]

I would say a defective O2 sensor

6 0
3 years ago
Which three of the following are used for mobile Internet access?
AlladinOne [14]
Bluetooth wifi and cell tower
8 0
3 years ago
Read 2 more answers
Why is computer science hardware needed to solve problems with computers?
dybincka [34]

Answer:

Computer science is the study of problems, problem-solving, and the solutions that come out of the problem-solving process. Given a problem, a computer scientist's goal is to develop an algorithm, a step-by-step list of instructions for solving any instance of the problem that might arise. ... Algorithms are solutions.

Explanation:

#CarryOnLearning

3 0
2 years ago
What are the elements of a good study environment? Check all that apply.
finlep [7]

The elements of a good study environment are that it must be well lit the resources are near it is quite and it is clutter free

Explanation:

A good study environment must be an environment that will promote the good study conditions and it must be quite and calm if a person studies in that environment all the resources like the food water and the other refreshments must be available in that environment

The environment must be clean and it must be clutter free without any disturbances and hence these are the factors that will promote the good study environment

3 0
3 years ago
Read 2 more answers
Fordham3 Hardware is known for its consensus buying center culture. Recognizing this corporate culture, someone attempting to se
balandron [24]

Answer: (c) focus exclusively on the head of the buying center.

Explanation:

As Fordham3 Hardware is known for its consensus buying center culture, so someone attempting to sell to Fordham3 should focus exclusively on the head of the buying center.

8 0
3 years ago
Other questions:
  • What kind of problems could you run into if you format a cell with the wrong format for the data type?
    15·2 answers
  • Describe mobile computing
    7·1 answer
  • To move up one paragraph, press the ____ key(s). f1 alt up arrow up arrow ctrl up arrow
    8·1 answer
  • Need help ASAP Examples of utilities that make it possible for people to create and share multimedia files include _____. audio
    9·2 answers
  • Because people can easily upload information and share online, they tend to:
    15·1 answer
  • 12. In cell A14, use the INDEX function and structured references to display the value in the first row and first column of the
    8·1 answer
  • Which of the following Access objects provides a user-friendly data entry method?
    7·1 answer
  • In cells D6 through D8, enter formulas to calculate the values of the stocks. The formulas should multiply the number of shares
    11·1 answer
  • When adding a component to a container with the ____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
    8·1 answer
  • you are asked to create a four-digit code using the numbers from 1 to 9. how many possible codes are there--assuming that number
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!