Data Structures

Setting up for software distribution

To use the make files in the software distribution for Design Patterns for Data Structures, you must set an environment variable DP4DS_DIR that specifies where the distribution directory resides. In a Unix/Linux machine, you do that by executing a command that depends on which shell you are using. In a Windows machine, you do it in the control panel.

Unix/Linux/Mac C shell

The C shell is the default shell on Sun. To set the environment variable on the command line, execute
setenv DP4DS_DIR /users/class/cs320/distribution
where /users/class/cs320/distribution is the path to the directory where the distribution software has been installed. This path is for the software that is installed on Sun for this course. If you have installed the software on your own machine, you must change the path accordingly. You can check to make sure DP4DS_DIR is set correctly by executing
env
If you don't want to bother setting the variable each time you login, you can put
setenv DP4DS_DIR /users/class/cs320/distribution
in your .login file. All the commands in the .login file execute each time you login. It is always a good idea to add an item in your .login file at the end of the file. If you put it at the beginning some of the later commands in the file might nullify your command. After putting the command in your .login file, execute
source .login
which re-executes the .login script.

Unix/Linux/Mac Bourne and Bash shells

Bash is the default shell on Linux and Mac OS X. (Bash is the "Bourne again shell", get it?) The export command is necessary for the variable to be available to child processes. Whereas the C shell executes the .login file when it starts up, the Bourne shells execute the .profile file. So, to use the make files on a Linux machine put the following lines in your .profile file.
DP4DS_DIR=/users/class/cs320/distribution
export DP4DS_DIR
where /users/class/cs320/ needs to be replaced by the full path name from the root directory to the directory where you installed the distribution. After putting the command in your .profile file, execute
source .profile
which re-executes the .profile script.

Windows XP

Click Start, then Control Panel, then System, then the Advanced tab, then the Environment Variables button, then the New button for System Variables. Enter the path to the folder where the software is installed.

Shell article

If you want to know more about the different shells, here is a good article.

Powered by Apache. Powered by Mac.