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
38. To select nonadjacent items, select the first item, such as a word or paragraph, as usual; then, press and hold down the ___
OLEGan [10]
In MS Word, you can use the keyboard keys to select nonadjacent items, these are items not next to each other. This is helpful when you are applying the same format to multiple items. To do this, select the first item which can be a word or paragraph, then press and hold down the CTRL key. While doing this, select the additional items.
7 0
3 years ago
____ data exist in a format that does not lend itself to processing that yields information.
Nastasia [14]
The word that goes in the blank is "unstructured."
4 0
4 years ago
Who made the first electronic device?
emmasim [6.3K]
Joseph Henry in about 1835. He is American and he made something called a relay.
6 0
3 years ago
How many times go you need to click the format painter button to apply copied formats to multiple paragraphs one right after the
Umnica [9.8K]
Double click would be enough
6 0
3 years ago
Read 2 more answers
What are possible consequences for cyberbullying?
BaLLatris [955]

Answer:

Possible consequences for cyber bullying include depression, isolation and illness

Explanation:

The reason for this is when a person is hurt there body tends to go through things to make them feel a certain way about things.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006.Given a variable modelYear write a statem
    5·1 answer
  • Approximately what percentage of the world population owns a smartphone?
    9·1 answer
  • What does the Auto Fill tool do?
    15·2 answers
  • How to learn how to use computers
    9·1 answer
  • A tripod head can move vertically or horizontally. What term describes these movements?
    15·2 answers
  • Dusk is considered “a magic hour” by photographers and is the time when light is the least harsh. True or false.
    12·2 answers
  • All of the following are potential benefits of blogging except
    10·1 answer
  • You are managing an FTP server installed in Ubuntu Server. The server has created a very large log le, vsftpd.log. Which command
    14·1 answer
  • Summarise all what you know about spss​
    15·1 answer
  • Make a list of any four computer that were used in the history of computer.​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!