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
PLZ HELP ME ITS URGENT PlZ PLZ PLZ
Lubov Fominskaja [6]

Answer:

#include <stdio.h>

void main()

{

int num;

printf("Input a number :");

scanf("%d", &num);

if (num >= 0)

printf("%d is a positive number \n", num);

else

printf("%d is a negative number \n", num);

}

Explanation:

good luck.

hope it helped you.

pls mark brainleist

8 0
3 years ago
The spellchecker can be found in which two locations in most wordprocessing software?
bogdanovich [222]
Editing tab or in the same section as the find comand
8 0
4 years ago
Suppose a computer has 16-bit instructions. The instruction set consists of 32 different operations. All instructions have an op
Kazeer [188]

Answer:

2^7= 128

Explanation:

An instruction format characterizes the diverse part of a guidance. The fundamental segments of an instruction are opcode and operands. Here are the various terms identified with guidance design:  Instruction set size tells the absolute number of guidelines characterized in the processor.  Opcode size is the quantity of bits involved by the opcode which is determined by taking log of guidance set size.  Operand size is the quantity of bits involved by the operand.  Guidance size is determined as total of bits involved by opcode and operands.

6 0
4 years ago
The letters a, e, i, o and u are the only vowels. Write a function named vowelUseDict() takes a string t as a parameter and comp
Andru [333]

Please specify the programming language.


3 0
4 years ago
Which key should you press to change the cell contents to your typed data
Free_Kalibri [48]

You can edit the contents of a cell directly in the cell. You can also edit the contents of a cell by typing in the formula bar.

When you edit the contents of a cell, Excel is operating in Edit mode. Some Excel features work differently or are unavailable in Edit mode.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Can a percent be used in a filename?
    13·1 answer
  • 2. Which of the following fonts is most legible for a block of text? What font size and color would you choose if you were writi
    11·2 answers
  • Harry is creating a PowerPoint presentation and wants all the slides to have a uniform look.
    8·1 answer
  • Lifelong learning _____. is only important for professionals with advanced degrees can be formal or informal includes formal cla
    12·1 answer
  • When a binary tree is full to its next to last level and its leaves on the last level are filled from left to right the tree is
    14·1 answer
  • In which type of class methods is it typically necessary to filter bad arguments (either directly or indirectly with the help of
    13·1 answer
  • How do i code........​
    6·2 answers
  • Sketch a 3-view orthographic projection of the object shown
    6·1 answer
  • Write a program that uses a stack to test input strings to determine whether they are palindromes. A palindrome is a sequence of
    7·1 answer
  • How do you think Beyoncé choreography has/will influence the future of dance?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!