i wrote this shell given below. please i need any suggestions and assistance in making this created shell support the following commands: cp (copy), del (delete), hos (prints the hostname of the machine), cd (changes directory), clr (clears the screen), dir (lists contents in directory), environ(lists the environment setting), echo (displays comment followed by a new line), help (displays the help associated with my shell) and quit ( exits the shell). please would be very grateful anyones attention shown too this. thank you




#include
#include
#include

main ()
{
char buf [1024];
char *args [64];

for (;
{
/*
*prompt for and read a command.
*/
printf ("Command:");

if (gets (buf) == NULL)
{
printf ("\n");
exit (0);
}

/*
* Split the string into Arguments.
*/
parse (buf, args);

/*
* Execute the command.
*/
execute (args);
} // endof for loop
}

/* parse -- Splits the command in buf into individual arguments */
parse (buf, args)
char *buf;
char **args;
{
while (*buf != NULL)
{
/*
*Strip White Spaces. Use Nulls, so
*that the previous argument is terminated automatically
*/
while ((*buf == ' ') || (*buff == '\t'))
*buf++ = NULL;

/* Save the Argument. */
*args++ = buf;

/* Skip over the argument. */
while ((* != NULL) && (*buf != ' ' ) && (*buf != '\t'))
buf++;
}

*args= NULL;
}

/* execute -- spawns a child process and execute the program */
execute (args)
char **args;
{
int pid,status;

/* Get a child process */

if ((pid= fork()) <0)
{ {
perror("fork");
exit (1);
/* NOTE. perror() produces a short error message on the standard
error describing the last error encountered during a call to a
system or library function */
}

/*
* The Child executes the code inside the if
*/
if (pid == 0)
{
execvp (*args, args);
perror (*args);
exit (1)

/* NOTE. The execv() and execvp versions of execl() are useful when the number
of arguments are unknown in advance:

The arguments to execv() abd execvp() are the name of the file to be executed
and a vector of strings containing the arguments. The last argument string must
be followed by a 0 pointer.

execlp() and execvp() are called with the same arguments as execl() and execv(),
but duplicate the shell's actions in searching for an executable file
environment. */

?* The parent executes the wait. */

while (wait (&status) !=pid)
/*empty */

}