Assignment 3, due Feb. 2
Part of
the homework for CS:3620, Spring 2018
|
On all assignments, your name must be legible as it appears on your University ID card! Assignments are due at the start of class on the day indicated (usually Friday). Exceptions will be by advance arrangement unless there is what lawyers call "an act of God" (something outside your control). Homework must be turned in on paper, either in class or in the teaching assistant's mailbox. Never push late work under someone's door!
>/bin/cc -o mush mush.c collect2: fatal error: cannot find 'ld' compilation terminated.
The problem is, /bin/cc relies on a search path that's part of the default environment.
A problem: Fix it. Everything you need to know to fix this is in the notes for Jan. 26. Only two lines of code are involved, so give your fix in the form of notes that explain what lines of code to add, delete or change. (1.0 points)
The getcommand() function in our minimal shell mush only uses getchar() to read lines. It could have used fgets(command,100,stdin) to read an entire line of text instead of using a loop of repeated calls to getchar().
A problem: Experiment with replacing the loop of repeated getchar() calls in mush with a single call to fgets() for reading the input command line. Study its behavior, with the goal of trying to figure out how getchar() and fgets() are related (that is, which of the three alternatives above describes their relationship.)
Identify the relationship and support your conclusion with descriptions of the observed behaviors that convince you of that relationship. (1.0 points)
We have already discussed the standard shell's search path, which it gets from the environment variable PATH. The following questions are best answered by a bit of judicious googling (lower case, because I use this verb to refer to use of any search engine).
a) Name some of the search paths that the cc command uses that are not involved with linking. (0.5 points)
b) Name at least one search path that the cc command is documented as using but is actually used by the linker. (0.5 points)