Dear Friends

i want help about the Simulate a Linux/UNIX shell, called MASH (for MiniAture SHell) in the C. plz read the the my problem and send the best solution of my problem as soon as possible.


Objectives:
After the completion of this assignment you’ll be able to:
Simulate a Linux/UNIX shell, called MASH (for MiniAture SHell) in the C language.
Description and Specifications:
The shell should have a prompt. It should accept commands, interpret them,
execute them, and then redisplay the prompt for the next command. The shell
should terminate on receiving EOF <Ctrl-D>. It is not acceptable for it to
terminate upon receiving a signal such as SIGINT <Ctrl-C>.

Built-in Functions:
The shell will implement six intrinsic functions:
cp copy a file
mv move a file
rm remove a file
cd ability to change to designated directory
mkdir for creating directory
rmdir for removing directory
By intrinsic, I mean built-in, i.e., the shell will have these functions built into it as
a process. This means that you will have to write the code for these commands
and not use the fork() and exec() system calls or the library function system().
History:
Maintain a history list of previously executed commands and allow the user to
access the commands in the history list with the “! operator.
1. Numerical Usage
!N means execution of the command which is N commands before the last
command such as !1 for executing the second to the last command. All the
commands have to be stored on disk upon exit. Assume that your shell will
serve last 100 commands i.e. !101 shall throw an error to the user.
2. Alphabetical Usage
!g would mean executing the last command that started with the letter g, such
as gcc assignment3.c.
Help Material:
You will use the fork() and execlp() or execvp() system calls to enable your
shell to support the above features unless specified otherwise. All other commands
should be passed to some parent shell and executed. This is done with the library
call system(). So, here is the list again:
. Ignore SIGINT <Ctrl-C>.
. Show your custom prompt.
. Get input and terminate on EOF <Ctrl-D>.
. Carry out (i.e., decode and execute) commands.
. Implement a simple parser to recognize "cp", "mv", "rm", and "cd" as
the first words of any set of input arguments. If recognized, carry out
the appropriate command by using your OWN code and NOT by using
the fork() and execlp() calls, or calling the library all system().
. If the first letter of a command is ! or the first letter of the second
word is |, use the fork() and execlp() system calls to implement the
required functionality.
. For all other commands, use the library call system() with the whole
input line as its argument.
. You MUST use the read() system call for reading input from the
keyboard.

Testing:
You have to encode the functionality so that to test MASH automatically, it can be
by using the following input parameters:
MASH -f input_file
[Note: MASH should terminate at the end of the input script-file.]
Reference:
signal(2)
system(3)
read(2)
open(2)
write(2)
stat(2)
fstat(2)
perror(3)
unlink(2)
close(2)
fork()
execlp()
execvp()

[/B]


thanks
Kashif07
<< moderator edit: removed email address >>

plz read the the my problem and send the best solution of my problem as soon as possible.

You're kidding, right?

Please read the Announcement.

This forum is meant for discussing programming languages in addition to exchanging code and algorithms. However, it has become a problem where too many students are posting homework problems expecting a quick solution without ever trying for themselves. Not only does this constitute cheating, but it is very discouraging, frustrating, and annoying to everyone who takes valuable time to answer programming support questions.

http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_faq#faq_rules

Keep it on the site
Please do not post asking for an answer to be sent to you via email. Problems and their responses assist others who read them. Please refrain from responding to people's questions via email for the same reason. Moderators may snip email addresses out of such posts without notice. That being said, please do not email or PM forum staff with your support questions. Also please do not ask support questions in the DaniWeb IRC chat. The chat is meant to offer a more laid back community atmosphere where members can get to know each other, and not as a venue to constantly ask/answer people's computer frustrations.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.