assignment1

Operating Systems and Computer Structures G2

Assignment 1

Due date

This assignment is due by 5pm, 17 August at the end of week 5.

Introduction

This assignment requires you to write a shell program that will display a list of commands. When a command is selected from the list it is executed. For example, the list may contain

    ls
    ls -l
If the command ls is selected, then it will be run showing the listing of files in the current directory.

Each command should be run asynchronously, so that selecting another command from the list will cause it to run.

The list should be shown using an X Windows application called xselect which will show the list like this:

Command execution

The program you will create (call it runit, for example) will run with either no parameters or one parameter. This parameter will be the name of a file containing a list of commands. If no file is specified on the command line, then it will default to the file .runitrc in your home directory.

The list of commands should be stored in the file, one per line.

xselect

The program xselect reads lines of text from standard input. It shows the input in a list, one line per element of the list. When an item of the list is selected by clicking on it, the line is sent to standard output.

When the Quit button is pressed, xselect will exit.

Errors

If runit is called with more than one argument, an error message should be printed and execution terminated. If the file used does not exist, an error should also be reported and execution terminated.

Submission

Do not hand in a copy of the program on paper. Instead, hand it in electronically using the command 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 your shell program. For example,

    give a1 runit

You may run give any number of times. Each time you run give it replaces any earlier submission of the assignment.