Review Unix Programming Tools and Basics of the C Language
This is a simple and important project for you to review Unix and C programming. Please do the following reading in order:
Write a one-line description for each of the
following commands:
1. xemacs &
2. cd
3. cat ~/.bashrc > tmpfile.txt
4. ln -s tmpfile.txt ~/tmp-alias
5. ls -al
6. chmod a+rwx tmpfile.txt
7. grep bash /etc/passwd
8. ps -ef | more
9. man 2 chown
10. gcc
test.c 2 > error-msg
In this problem, you will develop a few string manipulation functions similar to the standard C string functions. You are not allowed to use any standard string functions (e.g., strcpy, strlen, etc) in your code. Download the file mystring.tar.gz to your home directory on csil-cpu6.csil.sfu.ca (you may download the file to your machine first, then transfer it to csil-cpu6.csil.sfu.ca using any FTP client). After the download, issue the command:
tar xvfz mystring.tar.gz
which creates the directory ~/mystring. In that directory, you will find the following files:
mystring.h -- header file containing the prototypes for the functions that you will develop.
mystring.c -- source file in which you will do your coding.
test_mystring.c -- simple test file to help you testing your code.
Makefile -- this file is used by the Unix command make to compile your source code and build the executable files.
Start by issuing the command make to ensure that you got everything ready to start coding. The code should compile without a problem and you should find an executable file named test_mystring. Try it by issuing the command ./test_mystring. Of course, the tests there will fail. Now, start coding the functions in mystring.c one at a time and modify test_mystring.c to add more tests.
To help you testing your code, we provide below some testing programs. Copy test_mystring.c to your mystring directory. Compile your code again. Run the test file: ./test_mystring x, where x is the test number between 1 and 4.