Ringing the bell in calentool (pa

Craig Sarazin cls7i at astsun2.acc.virginia.edu
Fri Jan 13 21:32:18 AEST 1989


I recently asked if anyone knew how to make calentool ring the bell when
it notifies you of appointments.  Calentool is a very useful utility for
keeping track of appointments.  I received a number of replies.  Bill
Randle <billr%saab.cna.tek.com at relay.cs.net>, who has made many very
useful improvements to calentool, told me that later versions of calentool
include a "-b" option which beeps the bell and sends a message to the
console reminding you of an upcoming appointment (at the same time that
the icon reverse video's). Randle also said that he will be posting a new
version of calentool in the not too distant future with lots more bells
and whistles.

The simplest, most robust patch to Version 1.4 of calentool which makes
the bell ring when the icon changes to reverse came from John Scott
<scott at dg-rtp.dg.com>.  The rest of this message lists the changes to the
calentool.c file needed to make this changes.

Many thanks to John Scott, Bill Randle, and many other people who offered
suggestions and advise.

Craig Sarazin                            cls7i at virginia (BITNET)
Dept. of Astronomy                       cls7i at virginia.edu
University of Virginia

Differences to calentool.c, version 1.4
*************************************************************************
0a1
> /*    Modified Oct 21, 1988 to ring bell at appointment */
94a96
> int inverted = 0;
434a437
>               inverted = 0;
435a439,444
>         /* ring bell twice */
>         if (!inverted) {
>              RINGER(); RINGER();
>              inverted++;
>         }
>
439a449,471
> }
> #include <sundev/kbd.h>
> #include <sundev/kbio.h>
> RINGER()
> {
>     struct timeval timer;
>     register int kbd, op;
>     int cmd;
>
>     timer.tv_sec = 0;
>     if ((kbd = open("/dev/kbd", 1)) > -1) {
>         cmd = KBD_CMD_BELL;
>         timer.tv_usec = 100000;
>
>         ioctl(kbd, KIOCCMD, &cmd);
>         select(32, 0,0,0, &timer);
>         cmd = KBD_CMD_NOBELL;
>         ioctl(kbd, KIOCCMD, &cmd);
>
>         timer.tv_usec = 333333;
>         select(32, 0,0,0, &timer);
>     close(kbd);
>     } 



More information about the Comp.sys.sun mailing list