Notes about Shell Strategy

Notes about Shell Strategy - Notes about Shell Strategy q...

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

View Full Document Right Arrow Icon
Notes about Shell Strategy q The key point is that fdin is set to be the input for the next command. q fdin is a descriptor either of an input file if it is the first command or a fdpipe[1] if it is not the first command. q This example only handles pipes and in/out redirection q You have to redirect stderr for all processes if necessary q You will need to handle the “append” case
Background image of page 1

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

View Full DocumentRight Arrow Icon
Implementing Wildcards in Shell I suggest to implement first the simple case where you expand wildcards in the current directory. In shell.y, where arguments are inserted in the table do the expansion.
Background image of page 2
Implementing Wildcards in Shell Before argument: WORD { Command::_currentSimpleCommand->insertArgument($1); } ; After argument: WORD { expandWildcardsIfNecessary($1); } ;
Background image of page 3

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

View Full DocumentRight Arrow Icon
Implementing Wildcards in Shell void expandWildcardsIfNecessary(char * arg) { // Return if arg does not contain ‘*’ or ‘?’ if (arg has neither ‘*’ nor ‘?’ (use strchr) ) { Command::_currentSimpleCommand->insertArgument(arg); return; }
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

Notes about Shell Strategy - Notes about Shell Strategy q...

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

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