首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
EECS 678代写、C++设计编程代做
项目预算:
开发周期:
发布时间:
要求地区:
Quash Shell Documentation
EECS 678 - Quash Shell
Introduction
In this project, you will complete the Quite a Shell (quash) program using the UNIX system calls. You
may work in groups of 2. The purpose of this project is as follows:
Getting familiar with the Operating System (UNIX) interface.
Exercising UNIX system calls.
Understanding the concept of a process from the user point of view.
In essence, Quash should behave similar to csh, bash or other popular shell programs. You must use C,
C++, Rust, or Go to implement this project.
Features
The following features should be implemented in Quash:
Quash should be able to run executables (the basic function of a shell) with command line
parameters
If the executable is not specified in the absolute or relative path format (starting with sequences
of ‘/’, './', or '../'), quash should search the directories in the environment variable PATH (see
below). If no executable file is found, quash should print an error message to standard error.
Quash should allow both foreground and background executions. Character ‘&’ is used to
indicate background execution. Commands without ‘&’ are assumed to run in foreground.
When a command is run in the background, quash should print: "Background job started:
[JOBID] PID COMMAND"
When a background command finishes, quash should print: "Completed: [JOBID] PID
COMMAND"
[QUASH]$ program1 &
Background job started: [1] 2342 program1 &
[QUASH]$ ls
Documents Downloads
Completed: [1] 2342 program1 &
Quash should implement I/O redirection. The < character is used to redirect the standard input
from a file. The > character is used to redirect the standard output to a file while truncating the
file. The >> string is used to redirect the standard output to a file while appending the output to
the end of the file.
[QUASH]$ echo Hello Quash! > a.txt # Write "Hello Quash!\n" to a file
[QUASH]$ cat a.txt
Hello Quash!
[QUASH]$ echo Hey Quash! > a.txt # Trucates/overwrites a.txt contents
[QUASH]$ cat a.txt # Print file contents
Hey Quash!
[QUASH]$ cat < a.txt # Make cat read from a.txt via standard in
Hey Quash!
[QUASH]$ cat < a.txt > b.txt # Multiple redirect. Read from a.txt and write to b.txt.
[QUASH]$ cat b.txt
Hey Quash!
[QUASH]$ cat a.txt >> b.txt # Append output of a.txt to b.txt
[QUASH]$ cat b.txt
Hey Quash!
Hey Quash!
[QUASH]$
Quash should support pipes |.
[QUASH]$ cat src/quash.c | grep running
// Check if loop is running
bool is_running() {
return state.running;
state.running = false;
while (is_running()) {
[QUASH]$ cat src/quash.c | grep running | grep return
return state.running;
Quash should support comments # this is a comment. Quash should parse and interpret anything
before the '#' character if applicable, and discard anything after it.
[QUASH]$ echo "hello world" # this is a comment
hello world
[QUASH]$ # this is another comment -> Quash does nothing
[QUASH]$
Built-in Functions
All built-in commands should be implemented in quash itself. They cannot be external programs of any
kind. Quash should support the following built-in functions:
echo - Print a string given as an argument. The output format should be the same as bash (a string
followed by new line '\n')
[QUASH]$ echo Hello world! 'How are you today?'
Hello world! How are you today?
[QUASH]$ echo $HOME/Development
/home/jrobinson/Development
[QUASH]$ echo "Double quoted string" 12345
Double quoted string 12345
[QUASH]$
export - Sets the value of an environment variable. Quash should support reading from and
writing to environment variables.
[QUASH]$ export PATH=/usr/bin:/bin # Set the PATH environment variable
[QUASH]$ echo $PATH # Print the current value of PATH
/usr/bin:/bin
[QUASH]$ echo $HOME
/home/jrobinson
[QUASH]$ export PATH=$HOME # Set the PATH environment variable to the value of HOME
[QUASH]$ echo $PATH # Print the current value of PATH
/home/jrobinson
[QUASH]$
cd - Change current working directory. This updates both the actual working directory and the
PWD environment variable.
[QUASH]$ echo $PWD
/home/jrobinson
[QUASH]$ cd .. # Go up one directory
[QUASH]$ echo $PWD
/home
[QUASH]$ cd $HOME # Go to path in the HOME environment variable
/home/jrobinson
[QUASH]$
pwd - Print the absolute path of the current working directory. Make sure you are printing out the
actual working directory and not just the PWD environment variable.
[QUASH]$ pwd # Print the working directory
/home/jrobinson
[QUASH]$ echo $PWD # Print the PWD environment variable
/home/jrobinson
[QUASH]$ export PWD=/usr # Change the PWD environment variable
[QUASH]$ pwd
/home/jrobinson
[QUASH]$ echo $PWD
/usr
[QUASH]$
quit & exit - Use these to terminate quash. These are already implemented for you.
[BASH]$ ./quash
Welcome...
[QUASH]$ exit
[BASH]$ ./quash
Welcome...
[QUASH]$ quit
[BASH]$
jobs - Should print all of the currently running background processes in the format: "[JOBID] PID
COMMAND" where JOBID is a unique positive integer quash assigns to the job to identify it, PID is
the PID of the child process used for the job, and COMMAND is the command used to invoke the
job.
[QUASH]$ find -type f | grep '*.c' > out.txt &
Background job started: [1] 2342 find / -type f | grep '*.c' > out.txt &
[QUASH]$ sleep 15 &
Background job started: [2] 2343 sleep 15 &
[QUASH]$ jobs # List currently running background jobs
[1] 2342 find / -type f | grep '*.c' > out.txt &
[2] 2343 sleep 15 &
[QUASH]$
kill - Given a POSIX signal number (int) and a PID (int), Quash should send the signal to the given
process. The format shall be kill SIGNUM PID.
[QUASH]$ sleep 100 &
Background job started: [1] 4071 sleep 100 &
[QUASH]$ kill 2 4071 # send SIGINT signal to PID 4071
[QUASH]$ jobs # the process was terminated => no output
[QUASH]$
Useful System Calls and Library Functions
The following is a list and brief description of some system calls and library functions you may want to
use and their respective man page entries. Note that this list may not be exhaustive, but be sure what
ever library functions you use will run on the lab machines:
atexit(3) - Enroll functions that should be called when exit(3) is called
chdir(2) - Changes the current working directory
close(2) - Closes a file descriptor
dup2(2) - Copies a file descriptor into a specified entry in the file descriptor table
execvp(3) - Replaces the current process with a new process
exit(3) - Imediately terminate the current process with an exit status
fork(2) - Creates a new process by duplicating the calling process
getenv(3) - Reads an environment variable from the current process environment
getwd(3) - Gets the current working directory as a string (get_current_dir_name(3) may be easier
to use)
get_current_dir_name(3) - Gets the current working directory and stores it in a newly allocated
string
kill(2) - Sends a signal to a process with a given pid
open(2) - Opens a file descriptor with an entry at the specified path in the file system
pipe(2) - Creates a unidirectional communication pathway between two processes
printf(3) - Prints to the standard out (see also fprintf)
setenv(3) - Sets an environment variable in the current process environment
waitpid(2) - Waits or polls for a process with a given pid to finish
You may NOT use the system(3) function anywhere in your project
Project Hints and Comments
In Quash, a job is defined as a single command or a list of commands separated by pipes. For example
the following are each one job:
cat file.txt # A job with a single process running under it
find | grep *.qsh # A job with two processes running under it
A job may contain more than one process and should have a unique id for the current list of jobs in
Quash, a knowledge of all of the pids for processes that run under it, and an expanded string depicting
what was typed in on the command line to create that job. When passing the pid to the various print
job functions you just need to give one pid associated with the job. The job id should also be assigned
in a similar manner as bash assigns them. That is the job id of a new background job is one greater than
the maximum job id in the background job list. Experiment with background jobs in Bash for more
details on the id assignment.
Grading Policy
Partial credit will be given for incomplete programs. However, a program that cannot compile will get 0
points. The feature tests are placed into multiple tiers of completeness. The output to standard out from
your code must match our output exactly, except for whitespace, for the next tier of grading to be
accessible. This is due to reliance of previous tiers in subsequent tier tests. If we cannot run your code in
one tier then it becomes far more difficult test later tiers. The point breakdown for features is below:
Description Score
Tier 0
Quash compiles 10%
Tier 1
Single commands without arguments (ls)
Simple built-in commands
pwd
echo with a single argument
30%
Tier 2
Single commands with arguments (ls -a /)
Built-in commands
echo with multiple arguments
cd
export
Environment Variables
echo with environment variables (echo
$HOME)
Execution with environment variables (du -
H $PWD/..)
30%
Tier 3
Built-in commands
jobs
kill
Piping output between one command and
another (find -type f | grep '*.c')
Redirect standard input to any command from
file (cat < a.txt)
Redirect standard output from a command to a
file (cat b.txt > a.txt)
Background processes
30%
Job completion notification
Tier 4 (extra credit)
Pipes and redirects can be mixed (cat < a.txt |
grep -o World | cat > b.txt)
Pipes and redirects work with built-in commands
Append redirection (cat a.txt | grep -o World >>
b.txt)
10%
Valgrind Memory Errors
While not ideal, you will not lose any points for
"still reachable" blocks
Unacceptable Memory Leaks
Definately lost
Indirectly lost
Possibly lost
Unacceptable Access Violations
Invalid Read
Invalid Write
Invalid free
Use of uninitialized values
-5% from tier grade down to 0% for
each tier with violations
Submission
Each group (or individual) should submit the project via Canvas. The following will be expected in your
deliverables:
Source code files (.c, .cpp, .h, .rs, .go)
Makefile with the quash target defined
If using Rust or Go, include an 'instructions.txt' file for building and running your program. Include
the language version and other potentially helpful information.
Create a tar.gz archive of your deliverables. The TA should be able to run make quash to build your quash
executable and then run ./quash to execute your program. Ensure your code compiles and executes on
the EECS cycle servers (if C/C++).
Start early! GOOD LUCK.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
代做ece5550: applied kalman ...
2024-12-24
代做cp1402 assignment - netw...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!