[cs631apue] Final Questions

Jan Schaumann jschauma at stevens.edu
Fri Dec 14 11:58:26 EST 2012


tparisi <tparisi at stevens.edu> wrote:

> 1 and 2. How indepth should we go into explaining and pseudocoding the  
> shell?

You should provide a high-level description of what the shell does, how
it works, how it executes commands etc.  I'm guessing that might be
around 4-5 paragraphs / around a page or so.

The pseudo-code implementation should then cover what you talked about.

Consider (1) and (2) to be the first high-level steps before one might
actually implement such a shell.  That is, first comes an abstract
description, then pseudo code that shows what the English text might
translate to.

Pseudo code does not need to include variable or struct definitions and
the like, but should read/look pretty much like a program would.

> 5. What do you mean by overlay itself with a new process image?

That's just a description of what exec(3) does - it replaces the current
process in memory with the new executable.

> 14. How can we bind to port 13 if we're not the superuser?

You're right - you can't.  Let's change that to port 3113 instead.  I've
updated the final to reflect this.

> What if that  address is not avail ke on the host because it has not
> been assigned  that address by the dhcp server?

If your program cannot connect to the address specified (for whatever
reason), it will fail with a useful error message.

(This address is, by the way, configured on cs631-netbsd.netmeister.org,
where a process is listening on the given port (but discarding any data
it sees).)

> Lastly, do we send it a string when  running the program or through
> something like telnet? What do we do with  string that is passed to
> it?

For the 'send' program, you simply send the string given on the
command-line to the remote side.

For the 'listen' program, you simply read one line of data at a time


> 16. Are we to free the reversed string in the function or in main, I  
> believe it's main but I want to make sure?

What you do with the results of the 'rev' call in your main function is
up to you.  I only want to see it be able to call the function when
dynamically linked with your library (and fail when not).

> Is this library to be  statically or dynamically linked?

Dynamically linked.  I've updated the final to reflect this.

-Jan


More information about the cs631apue mailing list