SUMMARY: tty interface to Calendar Manager

From: Bill Maggio (bmaggio@lci.com)
Date: Sat Jul 22 1995 - 23:08:19 CDT


Thanks for all the replies. I got several helpful ones from
the following folks:

blymn@awadi.com.AU (Brett Lymn)
"Andrew Rouch" <andrewr@ncd.com.au>
Kevin.Sheehan@uniq.com.au (Kevin Sheehan {Consulting Poster Child})
Ronan KERYELL <Ronan.Keryell@cri.ensmp.fr>
jwc@icf.hrb.com (John Cieply)

Here was my original question:

=>We have users who only have basic terminal access to our server and
=>require a basic tty calendaring tool. Sun's Calendar Manager seems like
=>it may work, since it has three tty commands (cm_insert, cm_delete
=>and cm_lookup) that can be used to interface to the rpc.cmsd deamon.
=>
=>Before I embark on writing a wrapper script to around these three commands,
=>I wanted to see if there is anything like this floating around on the
=>'Net. Has anyone seen or use anything like this? If so, is it
=>publically available?
=>
=>Also, if anyone has a better suggestion for a basic, tty-based
=>calendaring tool that can be viewed and modified by other users, please
=>let me know.

Basically, I got a couple of scripts and a pointer to a commercial
package and an oldie, but a goodie public domain package called "month"
(available at ftp://ftp.uu.net/usenet/comp.sources.unix/volume9/month/).
The commercial package that was recommended is called Synchronize.
Available from Crosswind Technologies of (I think) Mt View, Ca. It
has Motif, ascii and MS Windows clients.

Finally, here are the two scripts that I received:

===============================================================================

Here is one:

>From blymn@awadi.com.AU Wed Jul 19 22:57 EDT 1995
From: blymn@awadi.com.AU (Brett Lymn)
Message-Id: <9507200252.AA00542@bunya.awadi>
Subject: Re: tty interface to Calendar Manager
To: bmaggio@lci.com
Date: Thu, 20 Jul 1995 12:22:06 +0930 (CST)
X-Mailer: ELM [version 2.4 PL2]
Mime-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Content-Length: 5045
X-Status:

#!/bin/sh
#
# Calendar Version 3
#
# based on Openwindows, Calendar manager
# Based on a script by ldg@scott.skidmore.edu (Leo D. Geoffrion) but
# hacked to convert from a csh to sh script and added some subtle new features.
#
# updated by blymn@awadi.com.au (Brett Lymn)
#
cmhost=bunya
user=`whoami`@$cmhost
date=today
view=day
#set -x
#
#
# lookup an entry
#
lookup()
{
  while :
  do
    echo "Defaults are:"
    echo " c (calendar) $user"
    echo " d (date) $date"
    echo " v (view) $view"
    echo -n "Enter c, d, v, (return) "
    read fres
    res=`echo $fres | awk '{print $1}'`
    rest=`echo $fres | awk '{print $2, $3, $4, $5, $6}' | sed 's/$ *//'`
    if [ "$res" = "" ]
    then
       cm_lookup -c ${user} -d ${date} -v ${view} | ${PAGER:-more}
       break
    fi
    if [ "$res" = "c" ]
    then
        if [ "$rest" = "" ]
        then
           echo -n "New calendar name: "
           read user
        else
           user=$rest
        fi
        continue
    fi
    if [ "$res" = "d" ]
    then
        if [ "$rest" = "" ]
        then
            echo -n "New date (mm/dd/yy, today, tomorrow, day): "
            read date
        else
            date=$rest
        fi
        continue
    fi
    if [ "$res" = "v" ]
    then
        if [ "$rest" = "" ]
        then
           echo -n "New view (day, week, month): "
           read view
        else
           view=$rest
        fi
        continue
    fi
 done
}

#
# delete an item
#
delete ()
{
while :
do
   echo "Defaults are:"
   echo " c (calendar) $user"
   echo " d (date) $date"
   echo -n "Enter c, v, (return): "
   read fres
   res=`echo $fres | awk '{print $1}'`
   rest=`echo $fres | awk '{print $2, $3, $4, $5, $6}'`
   if [ "$res" = "" ]
   then
       cm_delete -c ${user} -d ${date}
       break
   fi
   if [ "$res" = "c" ]
   then
        if [ "$rest" = "" ]
        then
           echo -n "New calendar name: "
           read user
        else
           user=$rest
        fi
        continue
   fi
   if [ "$res" = "d" ]
   then
        if [ "$rest" = "" ]
        then
           echo -n "New date (mm/dd/yy, today, tomorrow, day): "
           read date
        else
           date=$rest
        fi
        continue
   fi
done
}
#
# insert
#
insert()
{
start=""
end=""
what=""
while :
do
   echo "Defaults are:"
   echo " c (calendar) $user"
   echo " d (date) $date"
   echo " s (start time) $start"
   echo " e (end time) $end"
   echo " w (what text) $what"
   echo -n "Enter c, d, s, e, w, (return): "
   read fres
   res=`echo $fres | awk '{print $1}'`
   rest=`echo $fres | awk '{print $2, $3, $4, $5, $6}'`
   if [ "$res" = "" ]
   then
       echo "cm_insert -c ${user} -d ${date} -s ${start} -e ${end} -w ${what}"
       cm_insert -c ${user} -d ${date} -s ${start} -e ${end} -w ${what}
       break
   fi
   if [ "$res" = "c" ]
   then
        if [ "$rest" = "" ]
        then
            echo -n "New calendar name: "
            read user
        else
           user=$rest
        fi
        continue
   fi
   if [ "$res" = "d" ]
   then
        if [ "$rest" = "" ]
        then
           echo -n "New date (mm/dd/yy, today, tomorrow, day): "
           read date
        else
           date=$rest
        fi
        continue
   fi
   if [ "$res" = "s" ]
   then
        if [ "$rest" = "" ]
        then
            echo -n "New start time (hh:mm am/pm): "
            read start
        else
           start=$rest
        fi
        continue
   fi
   if [ "$res" = "e" ]
   then
        if [ "$rest" = "" ]
        then
            echo -n "New end time (hh:mm am/pm): "
            read end
        else
           end=$rest
        fi
        continue
   fi
   if [ "$res" = "w" ]
   then
        if [ "$rest" = "" ]
        then
            echo -n "New what : "
            read what
        else
           what=$rest
        fi
        continue
   fi
done
}

#
# The main loop.
#
while echo -n "Options are i (insert) d (delete) l (lookup) q (quit): "; read ans
do
   case $ans in
     i)
        insert
        ;;

     d)
        delete
        ;;

     l)
        lookup
        ;;

     q)
        exit
        ;;

     *)
        echo "Bad option"
        ;;
    esac
done

===============================================================================

And the other:

>From keryell@cri.ensmp.fr Thu Jul 20 05:23 EDT 1995
Date: Thu, 20 Jul 95 11:22:31 +0200
From: Ronan KERYELL <Ronan.Keryell@cri.ensmp.fr>
Message-Id: <9507200922.AA05549@cri.ensmp.fr>
To: bmaggio@lci.com
Subject: Re: tty interface to Calendar Manager
Content-Type: text
Content-Length: 1599
X-Status:

Do not forget that cm does not send mail neither notice if it is not actually
running... :-(
But the cm interface is nice, so...

This is why I wrote a small translator from the cm format to the calendar format
that I run every night with my crontab :

25 01 * * * $HOME/bin/gen_calendar

$HOME/bin/gen_calendar is :

#! /bin/csh

# Transfe`re les rendez-vous de CalendarManager dans .calendar re'gulie`rement.
# Ne ge`re que les add, pas les remove...

umask 077

set FICH_CALLOG_LOCAL=$HOME/bib/callog.`hostname`
set CALLOG=/usr/spool/calendar/callog.$USER
set TEMP=/tmp/gen_cal.$$

diff $CALLOG $FICH_CALLOG_LOCAL | \
        awk -F'"' '/^< \(add / { date = $2; rendez_vous = $4; \
                n = split(date,dates," "); \
                print dates[2] " " dates[3] ": " dates[4] ", " rendez_vous;}' \
> $TEMP

cat $HOME/.calendar >> $TEMP
mv /$TEMP $HOME/.calendar
cp $CALLOG $FICH_CALLOG_LOCAL

But it doesn't not deal with "cancel" nor "change".

By the way I use a slightly modified version of calendar that can also use the
.calendar file also, more discrete than the calendar in each home directory...



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:30 CDT