[alt.sources] Xkal - Patch01 and two "useful" programs

ferguson@cs.rochester.edu (George Ferguson) (11/16/90)

Well, it never fails. You ship something and it breaks. Here's a small
patch to apply to correct two bug(s) that didn't bite me but that got others.

I have also included in the shar two scripts "kal2remind" and "kal2pcal"
which translate xkal appointment files into xremind and pcal format
respectively. Actually, there are so many verions of pcal floating around
that I don't know for sure whether this will work for you.

1. Apply the patch with "patch < Patch01"

2. Use kal2remind as: "kal2remind >.xremind". It will read
   .appoints (won't check app-defaults but will use APPOINTS
   environemnt var) and write to stdout.

3. Use kal2pcal as:
	% kal2pcal >foobar
	% pcal -f foobar [month] [year] [num] | lpr ...
	% rm foobar
   It will cat .calendar to stdout if it exists, then convert .appoints
   (or $APPOINTS, as above) and output to stdout also.

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  Patch01 kal2pcal kal2remind
# Wrapped by ferguson@swan.cs.rochester.edu on Thu Nov 15 11:51:00 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Patch01' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Patch01'\"
else
echo shar: Extracting \"'Patch01'\" \(2642 characters\)
sed "s/^X//" >'Patch01' <<'END_OF_FILE'
XXkal - Patch01 - George Ferguson (ferguson@cs.rochester.edu)
X
XThis patch fixes the following bug(s):
XImakefile:	- use LOCAL_LIBRARIES rather than EXTRA_LIBRARIES
Xday.c:		- args[0] passed to XtSetValues() rather than args
X
X*** Imakefile.old	Thu Nov 15 11:47:52 1990
X--- Imakefile	Thu Nov 15 11:48:15 1990
X***************
X*** 20,26 ****
X  /**/#
X  EZMENU_DIR =		/u/ferguson/src/x/EzMenu
X  INCLUDES +=		-I$(EZMENU_DIR)
X! EXTRA_LIBRARIES +=	-L$(EZMENU_DIR) -lezMenu$(TARGET_MACH)
X  
X  /**/#
X  /**/# where is the app-defaults to C converter?
X--- 20,26 ----
X  /**/#
X  EZMENU_DIR =		/u/ferguson/src/x/EzMenu
X  INCLUDES +=		-I$(EZMENU_DIR)
X! LOCAL_LIBRARIES +=	-L$(EZMENU_DIR) -lezMenu$(TARGET_MACH)
X  
X  /**/#
X  /**/# where is the app-defaults to C converter?
X***************
X*** 31,37 ****
X  /**/# Nothing to change below here (except maybe CDEBUGFLAGS).
X  /**/#
X  DEPLIBS =		XawClientDepLibs
X! LOCAL_LIBRARIES =	XawClientLibs
X  CDEBUGFLAGS = 		-g
X  
X  SRCS = xkal.c month.c day.c schedule.c db.c util.c date-strings.c
X--- 31,37 ----
X  /**/# Nothing to change below here (except maybe CDEBUGFLAGS).
X  /**/#
X  DEPLIBS =		XawClientDepLibs
X! LOCAL_LIBRARIES +=	XawClientLibs
X  CDEBUGFLAGS = 		-g
X  
X  SRCS = xkal.c month.c day.c schedule.c db.c util.c date-strings.c
X*** day.c.old	Thu Nov 15 11:30:12 1990
X--- day.c	Thu Nov 15 11:29:49 1990
X***************
X*** 1,7 ****
X  /*
X   *	day.c : The day windows
X   *
X!  *	$Id: day.c,v 1.1 90/11/07 11:22:38 ferguson Exp $
X   */
X  #include <X11/Intrinsic.h>
X  #include <X11/Shell.h>
X--- 1,7 ----
X  /*
X   *	day.c : The day windows
X   *
X!  *	$Id: day.c,v 1.2 90/11/15 11:29:30 ferguson Exp $
X   */
X  #include <X11/Intrinsic.h>
X  #include <X11/Shell.h>
X***************
X*** 166,178 ****
X      for (i=0; i < 22; i++) {
X  	if ((s=lookupAppoint(i,day,month,year)) != NULL) {
X  	    XtSetArg(args[0],XtNstring,s);
X! 	    XtSetValues(d->items[i]->text,args[0],ONE);
X  	} else if ((s=lookupSchedule(i,day,month,year)) != NULL) {
X  	    XtSetArg(args[0],XtNstring,s);
X! 	    XtSetValues(d->items[i]->text,args[0],ONE);
X  	} else {
X  	    XtSetArg(args[0],XtNstring,"");
X! 	    XtSetValues(d->items[i]->text,args[0],ONE);
X  	}
X      }
X      d->day = day;
X--- 166,178 ----
X      for (i=0; i < 22; i++) {
X  	if ((s=lookupAppoint(i,day,month,year)) != NULL) {
X  	    XtSetArg(args[0],XtNstring,s);
X! 	    XtSetValues(d->items[i]->text,args,ONE);
X  	} else if ((s=lookupSchedule(i,day,month,year)) != NULL) {
X  	    XtSetArg(args[0],XtNstring,s);
X! 	    XtSetValues(d->items[i]->text,args,ONE);
X  	} else {
X  	    XtSetArg(args[0],XtNstring,"");
X! 	    XtSetValues(d->items[i]->text,args,ONE);
X  	}
X      }
X      d->day = day;
END_OF_FILE
if test 2642 -ne `wc -c <'Patch01'`; then
    echo shar: \"'Patch01'\" unpacked with wrong size!
fi
# end of 'Patch01'
fi
if test -f 'kal2pcal' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kal2pcal'\"
else
echo shar: Extracting \"'kal2pcal'\" \(881 characters\)
sed "s/^X//" >'kal2pcal' <<'END_OF_FILE'
X#!/bin/sh
X#
X#	kal2pcal: Convert kal appointment file to pcal format.
X#		  Weekly reminders are *not* included.
X#		  Cat's .calendar file also, if it exists.
X#		  Output to stdout.
X#
X#	George Ferguson, ferguson@cs.rochester.edu, 8 Jun 1990.
X#	New (one file) kal format, 7 Nov 1990.
X#
X
Xcase $# in
X    0) apps=$HOME/.appoints ;;
X    1) apps=$1 ;;
X    *) echo 'usage: kal2pcal [appoints]' >&2
X       exit ;;
Xesac
X
Xcal=${CALENDAR:-$HOME/.calendar}
Xif test -f $cal
Xthen
X    cat $cal
Xfi
X
Xawk '
X	BEGIN	{ mnum["Jan"] = 1
X		  mnum["Feb"] = 2
X		  mnum["Mar"] = 3
X		  mnum["Apr"] = 4
X		  mnum["May"] = 5
X		  mnum["Jun"] = 6
X		  mnum["Jul"] = 7
X		  mnum["Aug"] = 8
X		  mnum["Sep"] = 9
X		  mnum["Oct"] = 10
X		  mnum["Nov"] = 11
X		  mnum["Dec"] = 12
X		}
X     /^ ?[0-9]/	{ 
X		  printf "%02d/%02d/%s ",mnum[$2],$1,$3
X		  for (i=4; i <= NF; i++)
X		      printf "%s ", $i
X		  printf "\n"
X		}
X' $apps
END_OF_FILE
if test 881 -ne `wc -c <'kal2pcal'`; then
    echo shar: \"'kal2pcal'\" unpacked with wrong size!
fi
chmod +x 'kal2pcal'
# end of 'kal2pcal'
fi
if test -f 'kal2remind' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'kal2remind'\"
else
echo shar: Extracting \"'kal2remind'\" \(1155 characters\)
sed "s/^X//" >'kal2remind' <<'END_OF_FILE'
X#!/bin/sh
X#
X#	kal2remind : Convert kal appointment files to xremind format.
X#		     Output to stdout.
X#
X#	George Ferguson, ferguson@cs.rochester.edu, 8 Jun 1990.
X#	New kal (one file) format, 7 Nov 1990.
X#
X
Xcase $# in
X    0) apps=$HOME/.appoints ;;
X    1) apps=$1 ;;
X    *) echo 'usage: kal2remind [appoints]' >&2
X       exit ;;
Xesac
X
Xawk '
XBEGIN	{ mnum["Jan"] = 1
X	  mnum["Feb"] = 2
X	  mnum["Mar"] = 3
X	  mnum["Apr"] = 4
X	  mnum["May"] = 5
X	  mnum["Jun"] = 6
X	  mnum["Jul"] = 7
X	  mnum["Aug"] = 8
X	  mnum["Sep"] = 9
X	  mnum["Oct"] = 10
X	  mnum["Nov"] = 11
X	  mnum["Dec"] = 12
X	}
X/^[A-Z]/ { split($2,time,":")
X	   if (time[2] < 5) {
X	       time[1] -= 1
X	       time[2] = 55 + time[2]
X	   } else
X	       time[2] -= 5
X	   printf "%s %2d:%02d ",$1,time[1],time[2]
X	   for (i=3; i <= NF; i++)
X	       printf "%s ", $i
X	   printf "[%s]\n",$2
X	 }
X/^ ?[0-9]/ { split($4,time,":")
X	     if (time[2] < 5) {
X	         time[1] -= 1
X	         time[2] = 55 + time[2]
X	     } else
X	         time[2] -= 5
X	     printf "%02d/%02d/%s %2d:%02d ",mnum[$2],$1,$3,time[1],time[2]
X	     for (i=5; i <= NF; i++)
X	         printf "%s ", $i
X	     printf "[%s]\n",$4
X	   }
X' $apps
END_OF_FILE
if test 1155 -ne `wc -c <'kal2remind'`; then
    echo shar: \"'kal2remind'\" unpacked with wrong size!
fi
chmod +x 'kal2remind'
# end of 'kal2remind'
fi
echo shar: End of shell archive.
exit 0
-- 
George Ferguson			ARPA: ferguson@cs.rochester.edu
University of Rochester		UUCP: {decvax,rutgers}!rochester!ferguson
Rochester  NY  14627		VOX:  (716) 275-2527