Project 1


One of the texts for this class is the “Advanced Programming in the UNIX® Environment”, Second Edition, by Stevens and Rago . On the Web site of the book (http://www.apuebook.com/) there is a compressed, "tarred", file of all the programming examples in this text. Download the file ((click here to download the file) to your Fedora virtual machine. Uncompress the file using the command gzip, and look at the archive using the command tar with the options t and f. Unpack the archive using tar and options v,x, and f. Write a script to count the number of "c" programs unpacked and output this number to Standard Output. A c program is identified for this project as the contents of a file whose name terminates with the characters .c

Now write two Bourne Shell script to do the following:

 

  1. Examine the directory tree you unloaded above and find all the C programs. That is those programs in files whose names end with .c.

    Concatenate those C programs into a single file in your home directory named CPROGRAMS.c

    Use the stream editor sed to replace all runs of spaces and tabs with a single space.
    Use the filter grep to remove all #include lines.
    Use the filter grep to remove all empty lines.


  2. Extract from the CPROGRAMS.c file (produced in the previous part) a list of function calls used in the C programs. A function call has the form name(arguments) where name is a nonempty string of lowercase letters and the underscore symbol _.

    Determine for each name in the set you have extracted whether a UNIX manual page exists for the function. If it does write the name of the function to Standard Output. If it does not exist discard the function name.


Compress the scripts written for this project into one zip file and submit a softcopy to Moodle.

Note: No part of your program may be written in C, C++, JAVA or similar such languages.