CSE321Week5 - CSE 321 Panya Chanawangsa pc57@buffalo.edu...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 321 Panya Chanawangsa pc57@buffalo.edu
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Today’s Agenda • Argument Handling Revisited 3.5.i) eval ( xsh_eval.c ) 3.5.ii) ledLoop ( xsh_ledLoop.c ) 3.7) Write a simple cyclic executive 3.8) chat (built on top of 3.7, so you only need to write one command ( xsh_chat.c )
Background image of page 2
Basic VI Commands • To create a new file, vi filename • Two modes: – To enter the insert mode, i – To enter the command mode, [ESC]
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
• Note that all of these commands have to be entered in the command mode. • To save and quit, :wq • To quit without saving, :q! • To undo (toggle), u • To search /keyword
Background image of page 4
• To delete from this point to the EOL D • To delete the current line, dd • To delete 5 lines, 5dd • To copy, yy • To copy 5 lines, 5yy • To paste, p
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Argument Handling Revisited eval 4 + 5 / 2 • Each argument is separated by a blank space • nargs automatically stores the number of arguments. In this case, nargs == 6. • args[] automatically stores all the arguments. Each argument can be accessed through direct indexing.
Background image of page 6
Argument Handling Revisited eval 4 + 5 / 2 args[0] args[1] args[2] args[3] args[4] args[5] “eval” “4” “+” “5” “/” “2”
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
• Each argument is stored as a string, or, strictly speaking, an array of characters. • Therefore, the declaration below will result in
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 24

CSE321Week5 - CSE 321 Panya Chanawangsa pc57@buffalo.edu...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online