Rather than a set of unrelated exercises, the intention this year is to build a realistic program at the end, with the earlier exercises forming components or simpler versions. The program (or rather, programs) will give a basic version of the type of problem that is commonly talked about today with the increase in use of the Internet. The programs will provide a ``jukebox'' on the Internet, where a set of sound files are stored on one server computer on the network. This server can be queried for a list of the sound files, or can be requested to send a file to another machine where it can be played using the local sound card.
list_sounds
, fetch_sound
,
xselect
and xwarn
, supplied by the lecturer.
The purpose is to get the list of sounds and display them so that they can be selected by the user. Once selected, a sound file is fetched and played.
To avoid repeated fetches across the network of the same sound files, each file should be `cached' locally so that it can be reused if needed.
The concepts that are used in this assignment are
list_sounds
fetch_sound
list_sounds
. If the file is valid, it writes to
standard output the contents of the file. If successful, the exit code is 0,
otherwise it is non-zero.
xselect
{Beatles ``Help''}
.
xwarn
bash
shell program. It should obtain
a list of sound files and their descriptions, and display the
descriptions as a list using xselect
. When the user selects a
description, the corresponding sound file must be used.
A check should be
made as to whether or not the sound file is in the local cache,
that is, if it is
stored in directory .sounds
relative to the current directory.
If it is, it should be used, otherwise it must be fetched across the
network. When fetched, it must also be stored in the cache.
The sound file will be used by playing it i.e. by writing it to
the device /dev/audio
.
When the program exits, it must clean up the cache by removing the directory and all of its files.
xerror
. If they are fatal errors, the program should
terminate, but otherwise continue.
give
.
This command runs with two parameters.
The first parameter should be the string ``a1'' and the second should be the
name of the file containing the source of your shell program. For example,
if your shell file is called jukebox
give a1 jukebox
You may run give
any number of times.
Each time you run give
it replaces any
earlier submission of the assignment.
No record is kept of the number of submissions.
It does not alter your file in any way - it just makes a copy in a place
accessible only to the lecturer.
If you are running Linux, then you will need binary copies of some programs. See here for more information.