Assignment 4: Scripting

Due Wednesday, November 19, 2003 before class

For this assignment, your task is to script new UNIX tools for managing events in a calendar. The major functionality that you will provide is:

More specifically, you will create two scripts. The first, written with ksh, will take care of creating and deleting events, or getting event file names. The second, written in Perl, will display a calendar. The data about events will reside as plain ASCII files on the file system.

Part I

    Implement the command planner. Usage:

      planner option year month day hour minute args

    Where option is one of the following and args depends on the option:

    The arguments year, month, day, hour and minute should all be integers. Specifically year should always be 4 digits, and the other should always be 2 digits (e.g. 01). Hour is 24 hour time where 00 is midnight and 23 as 11PM.

    An error should be reported if the arguments do not match what is specified above.

Part II

    Write a perl script called plannerview, which has the following usage:
    plannerview year month day [user]
    
    The command should go through all the events on the given year, month and day in the user's calendar and print them. Any file that does not have read permission should be marked as restricted. If the user is not specified, assume the current user.

    It is up to you how you display the info, as long as all the times, lengths, titles and descriptions are printed.

File organization

    You must organize your files in the following way:

Examples

    $ planner -a 2003 11 12 19 00 120 'UNIX Tools Lecture 11'
    This is a two hour long lecture about
    UNIX Programming Tools.
    
    $ planner -d 2003 11 12 19 01
    No such event
    $ planner -d 2003 11 12 19 00
    
    $ planner -p 2003 11 12 19 00
    /home/jlo/.planner/2003/11/12/19/00.120
    $ cat $(planner -p 2003 11 12 19 00)
    UNIX Tools Lecture 11
    This is a two hour long lecture about
    UNIX Programming Tools.
    $ chmod 600 $(planner -p 2003 11 12 19 00)
    
    $ plannerview 2003 11 12
    19:00 [120 minutes] UNIX Tools Lecture 11
       This is a two hour long lecture about
       UNIX Programming Tools.
    
    $ plannerview 2003 11 12 kornj
    14:00 [60 minutes] Restricted
    18:55 [5 minutes] Prepare Lecture
    19:00 [120 minutes] UNIX Class
       Teach class
    22:00 [60 minutes] South Park
    

Turning in the assignment