Lab Assignment--Tokenizing and Parsing

Part 1-Examine and Modify Existing Code

Use the following line to copy this week's code (A modification of a small part of Dr. Hilderman's HALshell):
cp /net/data/ftp/pub/class/330/Linux/Hilder_Exercise/Exercise/* .
  1. Store the answer to the following questions as comments at the beginning of main.cpp:
    1. What is Dr. Hilderman's code tokenizing based on (ie. what delimeter(s) separate(s) his words)?
    2. What are two reasons why his tokens are strings instead of c strings
  2. Add functionality to the ProcessCommand function so that "lo" will also cause the shell to exit

Part 2-Extend the Code

We want to be able to turn the tokens array into an array of c strings (In other words, in the format of char **). Build the following functions and call them from main:

A sample run might look something like the following

HALshell> This is a test
The words in reverse are: test a is This
HALshell> to see what happens
The words in reverse are: happens what see to
HALshell> It is a success
The words in reverse are: success a is It
HALshell> lo
The words in reverse are: lo

HALshell: terminating ...


Submit 4 files to URCourses:
  1. code for HALmod.cpp
  2. code for HALmod.h
  3. code for main.cpp
  4. script of run