xselect
program. That is, it reads a set of filenames and checks if they are
in the cache. If not, it fetches the file and stores it in the cache.
Then it writes it to the sound device.
The concepts that are used in this assignment are
~ostutes/libA2.a
.
If your source is
a2.c
that you are compiling to a2
, use this
command line:
The function takes a filename as parameter, that hopefully is one that
came from the program list_sounds. It returns an array
of characters (bytes), NULL terminated (i.e. a string)
if the file can be fetched.
If not, it returns NULL. This array is dynamically allocated by
fetch_sound
. Your program is responsible for freeing the
memory when it is no longer needed.
The program reads lines from standard input. Each line is expected to be the name of a file. It terminates on EOF from stdin.
If the file does
not exist in the directory .sounds
then a file of that
name must be created in the cache directory. The contents of the file
should be from a call to fetch_sound
.
The file should be copied to /dev/audio
.
When EOF is reached on input, the cache directory and all its contents should be removed and the program should terminate normally.
give
.
This command runs with two parameters.
The first parameter should be the string ``a2'' and the second should be the
name of the file containing the source of your shell program. For example,
give a2 myass2.c
You may run give
any number of times.
Each time you run give
it replaces any
earlier submission of the assignment.
Submit only the source code. Do NOT give the executable file!!! I can't extract the source code from an executable, so it can't be marked. If you give an executable, then it will not be tested or marked and you will have to resubmit it.
If you are running Linux, then you will need binary copies of some programs. See here for more information.