Getting Started

Description of the problem

Each line of the file represents a single appointment. An appointment consists of two fields: a time and a description. One or more tabs must separate the two fields. Appointments may occur in any order, and times in a variety of convenient formats should be permitted.

The program, which we will call calendar, takes three command-line options. The first two of these are options that have no value after the option:

   calendar -t <calfile  display an ordered list of today's appointments
   calendar -n <calfile  print the next appointment
For example, suppose it is currently 2PM on April 26. Then the command:
       calendar -t <calfile
would print:
       Your appointments for 04/26/91:
           12:00:00        lunch with Andy
           15:00:00        group meeting
while this command:
       calendar -n <calfile
would print:
       Your next appointment is on 04/26/91:
           15:00:00        group meeting
Finally, the -r option takes a regular expression which is used to limit consideration to those appointments the user is interested in. For example to determine when the next appointment with a family member will occur, the user can say:
      calendar -n -r 'wife|brother|aunt|uncle' <calfile
which would print:
       Your next appointment is on 04/29/91:
           14:00:00        visit Aunt Edna
The remainder of this tutorial is devoted to implementing the electronic appointment calendar.
Next topic: Start by assembling the obvious components
Previous topic: A bigger example

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005