📄 project1.htm
字号:
lang=EN-US>InputRedirect := <SPAN
style="mso-tab-count: 1">
</SPAN>NULL</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt; TEXT-INDENT: 36pt"><SPAN
lang=EN-US>
<SPAN style="mso-tab-count: 1"> </SPAN><
STRING</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 36pt"><SPAN
lang=EN-US>OutputRedirect := <SPAN
style="mso-tab-count: 1">
</SPAN>NULL</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 108pt; TEXT-INDENT: 36pt"><SPAN
lang=EN-US>> STRING</SPAN></P>
<P class=MsoNormal><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 36pt"><SPAN
lang=EN-US>ExecFile := <SPAN
style="mso-tab-count: 1">
</SPAN>STRING</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 36pt"><SPAN
lang=EN-US>Args
:= <SPAN
style="mso-tab-count: 2">
</SPAN>NULL</SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 108pt; TEXT-INDENT: 36pt"><SPAN
lang=EN-US>STRING Args</SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P></DIV><![if !mso]></TD></TR></TBODY></TABLE><![endif]></v:textbox><w:wrap
anchorx="page" type = "square"></w:wrap></v:shape><![endif]--><![if !vml]><img width=579 height=564src="./Linux-1.files/image001.gif" align=left hspace=12alt="文本框: CommandLine := NULL FgCommandLine FgCommandLine & FgCommandLine := SimpleCommand FirstCommand MidCommand LastCommand SimpleCommand := ProgInvocation InputRedirect OutputRedirect FirstCommand := ProgInvocation InputRedirect MidCommand := NULL | ProgInvocation MidCommand LastCommand := | ProgInvocation OutputRedirect ProgInvocation := ExecFile Args InputRedirect := NULL < STRING OutputRedirect := NULL > STRING ExecFile := STRING Args := NULL STRING Args "v:shapes="_x0000_s1035"><![endif]></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 36pt"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<H1><SPAN lang=EN-US>A Suggested Plan Of Attack</SPAN></H1>
<P class=MsoNormal><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></B></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><A
name=plan></A><![if !supportLists]><SPAN lang=EN-US>1)<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Read the man pages for </SPAN><SPAN
class=HTMLTypewriter><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑体">fork</SPAN></SPAN><SPAN
lang=EN-US>, </SPAN><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑体">exec</SPAN></SPAN><SPAN
lang=EN-US>, </SPAN><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑体">wait</SPAN></SPAN><SPAN
lang=EN-US> and </SPAN><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑体">exit</SPAN></SPAN><SPAN
lang=EN-US>. </SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>2)<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Write a few small programs to
experiment with these commands.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
class=HTMLTypewriter><SPAN lang=EN-US
style="mso-fareast-font-family: 'Times New Roman'; mso-ansi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">3)<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN></SPAN><![endif]><SPAN lang=EN-US>Read the man pages for
</SPAN><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑体">tcsetgrp()</SPAN></SPAN><SPAN
lang=EN-US> and </SPAN><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑体">setpgid()</SPAN></SPAN><SPAN
class=HTMLTypewriter><SPAN lang=EN-US
style="mso-fareast-font-family: 'Times New Roman'; mso-ansi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>4)<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="mso-fareast-font-family: 'Times New Roman'; mso-ansi-font-size: 12.0pt; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">Write
some code to experiment with process groups, &c. Pay attention to SIGTTIN
& SIGTTOU.</SPAN></SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>5)<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Design your parser.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>6)<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Implement your parser.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>7)<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Using your parser, write a simple shell
that can execute single commands.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>8)<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Add support for running programs in the
background, but don’t worry about printing the message when a background job
terminates (asynchronous notification). Add the jobs command while you are doing
this – it may prove helpful for debugging. </SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>9)<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN><![endif]><SPAN lang=EN-US>Add input and output redirection
</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>10)<SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN><![endif]><SPAN lang=EN-US>Add code to print a message when a
background job terminates.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>11)<SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN><![endif]><SPAN lang=EN-US>Add job control features - implement
the behavior of Control-Z (and, if applicable, CONTROL-C), </SPAN><SPAN
class=HTMLTypewriter><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑体">fg</SPAN></SPAN><SPAN
lang=EN-US> and </SPAN><SPAN class=HTMLTypewriter><SPAN lang=EN-US
style="FONT-FAMILY: 'Courier New'; FONT-SIZE: 10pt; mso-bidi-font-family: 黑体">bg</SPAN></SPAN><SPAN
lang=EN-US>.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>12)<SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN><![endif]><SPAN lang=EN-US>Add support for pipes.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>13)<SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN><![endif]><SPAN lang=EN-US>Finish up all of the details</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>14)<SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN><![endif]><SPAN lang=EN-US>Test, test test.</SPAN></P>
<P class=MsoNormal
style="MARGIN-LEFT: 36pt; TEXT-INDENT: -18pt; mso-list: l4 level1 lfo10; tab-stops: list 36.0pt"><![if !supportLists]><SPAN
lang=EN-US>15)<SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN></SPAN><![endif]><SPAN lang=EN-US>Celebrate</SPAN></P>
<H1><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></H1>
<P class=NormalWeb style="MARGIN-RIGHT: 36pt"><B
style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US>Environment</SPAN></B><SPAN lang=EN-US> </SPAN><SPAN lang=EN-US
style="mso-fareast-font-family: 'Arial Unicode MS'"><o:p></o:p></SPAN></P>
<P class=NormalWeb style="MARGIN-RIGHT: 36pt"><SPAN lang=EN-US>Whereas you can
do this assignment on any UNIX, it must run on the Linux machines for your demo.
We encourage you to work in that environment, because the libraries for future
projects are only available in the Andrew environment. </SPAN></P>
<P class=NormalWeb style="MARGIN-RIGHT: 36pt"><SPAN lang=EN-US>Although you can
solve this assignment in your choice of languages, it would probably be more
difficult in anything other than C (or perhaps C++). We strongly encourage
you to use C. </SPAN></P>
<P class=NormalWeb style="MARGIN-RIGHT: 36pt"><SPAN lang=EN-US>For future
projects you'll almost certainly have to use C. C++ may work, but we offer no
guarantees. There is a difference in the linking convention between the two
languages that causes incompatibilities. We've tried to correct this, but we
make no promises about C++. </SPAN></P><B
style="mso-bidi-font-weight: normal"><SPAN lang=EN-US
style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: 宋体; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><BR
clear=all style="PAGE-BREAK-BEFORE: always"></SPAN></B>
<P class=MsoNormal><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>Some
Useful Information (Some of which is a review)</SPAN></B><SPAN lang=EN-US>
</SPAN><SPAN lang=EN-US
style="FONT-FAMILY: 'Arial Unicode MS'; mso-bidi-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<H1><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></H1>
<H1><SPAN lang=EN-US>System Calls</SPAN></H1>
<P class=MsoNormal><SPAN
lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></SPAN></P>
<P class=MsoNormal><A name=syscalls></A><SPAN lang=EN-US>You have
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -