| OpSys Spring 2006 - HW3 FAQ |
|   OpSys Home   |   HW3 Assignment |
+ Regular expression containing the '|' character
|
Question: | When I put |
|
Answer: | If you want to recognize the pipe symbol in a regular expression,
you need to escape it - you need to use |
+ Determining whether a file is executable
|
Question: | I'm not sure how to tell if a file is a command, and whether or not I have permission to execute it. |
|
Answer: | In general this is not trivial, as you need to match the owner of the file to the uid of the process itself (who is running your program) and check the user-executable permission bit (S_IXUSR), if that doesn't indicate the file is executable by the process, you would need to try the groups (group owner of the file, group id of the running process and group permission bit), and finally the "other" execute permission bit. For this assignment, you should simply make sure that the file is executable by "other" (use S_IXOTH), this will allow your shell to run programs like ls and sort. See the sample solution to question #6 on this old test: Test #1 for an example of how to do this. |
+ input line parsing
|
Question: | What kind of input lines are we expected to be able to handle? |
|
Answer: | For starters, we should not be able to crash your program no matter what we type in as input! As for what kind of command lines you are expected to be able to process:
|