xdiary 3/5 (X based calendar and diary)

Jason Baietto jason at gcx1.ssd.csd.harris.com
Thu Dec 13 10:27:49 AEST 1990


#! /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 archive 3 (of 5)."
# Contents:  diary.c xdiary.man
# Wrapped by jason at hcx2 on Thu Dec  6 12:49:22 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'diary.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'diary.c'\"
else
echo shar: Extracting \"'diary.c'\" \(15472 characters\)
sed "s/^X//" >'diary.c' <<'END_OF_FILE'
X/*
X * Author: Jason Baietto, jason at ssd.csd.harris.com
X * xdiary Copyright 1990 Harris Corporation
X *
X * Permission to use, copy, modify, and distribute, this software and its
X * documentation for any purpose is hereby granted without fee, provided that
X * the above copyright notice appear in all copies and that both that
X * copyright notice and this permission notice appear in supporting
X * documentation, and that the name of the copyright holder be used in
X * advertising or publicity pertaining to distribution of the software with
X * specific, written prior permission, and that no fee is charged for further
X * distribution of this software, or any modifications thereof.  The copyright
X * holder makes no representations about the suitability of this software for
X * any purpose.  It is provided "as is" without express or implied warranty.
X *
X * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND IN NO
X * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ITS USE,
X * LOSS OF DATA, PROFITS, QPA OR GPA, WHETHER IN AN ACTION OF CONTRACT,
X * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
X * THE USE OR PERFORMANCE OF THIS SOFTWARE.
X */
X
X/*
X   diary.c -- routines to read, manage, and save the diary file.
X
X   Diary format:  newline terminated date string followed by a
X                  newline terminated quote enclosed string.
X                  The string may contain newlines and quotes, but
X                  quotes must be doubled (i.e. "" becomes ").
X
X   The diary format is very simple so that it can easily be updated
X   in a text editor for people who want to add text to a date but
X   are too impatient to bring up the xdiary application.
X
X   Author: Jason Baietto
X     Date: October 19, 1990
X*/
X
X
X/*---------------------------------------------------------------------------*/
X/*                               Header Files                                */
X/*---------------------------------------------------------------------------*/
X#include <stdio.h>
X#include <ctype.h>
X#include <values.h>
X#include <X11/Intrinsic.h>
X#include "Date.h"
X
X
X/*---------------------------------------------------------------------------*/
X/*                          Global Types And Macros                          */
X/*---------------------------------------------------------------------------*/
X#define START_LENGTH 20000
X#define GROW_LENGTH 10000
X#define INIT_YEARS 10
X#define NEWLINE '\n'
X#define QUOTE   '\"'
X#define STRING 0
X#define DATE 1
X#define EMPTYSTRING ""
X
Xtypedef struct day_entry_type {
X   char * text;
X   int  freeable;
X} day_entry;
X
Xtypedef struct month_entry_type {
X   struct day_entry_type day[31];
X} month_entry;
X
Xtypedef struct year_entry_type {
X   int year;
X   struct month_entry_type * month[12];
X   struct year_entry_type * next;
X   struct year_entry_type * prev;
X} year_entry;
X
Xstatic year_entry head;
Xstatic year_entry tail;
X
X/*---------------------------------------------------------------------------*/
X/*                              Static Routines                              */
X/*---------------------------------------------------------------------------*/
Xstatic char * read_diary(file_name)
Xchar * file_name;
X{
X   int i = 0;
X   int c = 0;
X   char * char_ptr;
X   long current_length = START_LENGTH;
X   FILE * file;
X
X   char_ptr = (char *) XtMalloc(current_length);
X
X   file = fopen(file_name, "r");
X   if (!file) {
X      return ((char *) NULL);
X   }
X
X   /* Just read the whole thing into memory to minimize file I/O time */
X   while (c != EOF) {
X      c = getc(file);
X      char_ptr[i++] = c;
X
X      if (i >= current_length) {
X         current_length += GROW_LENGTH;
X         char_ptr = (char *) XtRealloc(char_ptr, current_length);
X      }
X   }
X
X   fclose(file);
X   return(char_ptr);
X}
X
X
X
X
X/*---------------------------------------------------------------------------*/
X/*                              Global Routines                              */
X/*---------------------------------------------------------------------------*/
Xvoid install(date, string, freeable)
XDate date;
Xchar * string;
Xint freeable;
X{
X   year_entry  * year_ptr = &head;
X   year_entry  * save_ptr;
X   year_entry  * last_ptr;
X   month_entry * month_ptr;
X   day_entry   * day_ptr;
X
X   /* Find or create the year entry. */
X   while (year_ptr) {
X      if (year_ptr->year < date.year) {
X         /* Not yet, try the next year entry. */
X         last_ptr = year_ptr;
X         year_ptr = year_ptr->next;
X      } else if (year_ptr->year > date.year) {
X         /* No year entry exists, create one. */
X         save_ptr = year_ptr;
X         year_ptr = (year_entry *) XtCalloc(1, sizeof(year_entry));
X         last_ptr->next = year_ptr;
X         year_ptr->next = save_ptr;
X         year_ptr->prev = last_ptr;
X         save_ptr->prev = year_ptr;
X         year_ptr->year = date.year;
X         break;
X      } else {
X         /* Found it. */
X         break;
X      }
X   }/*while*/
X
X   /* Find or create the corresponding month array. */
X   month_ptr = year_ptr->month[date.month-1];
X   if (!month_ptr) {
X      month_ptr = (month_entry *) XtCalloc(1, sizeof(month_entry));
X      year_ptr->month[date.month-1] = month_ptr;
X   }
X
X   day_ptr = &month_ptr->day[date.day-1];
X   if (!day_ptr->text) {
X      /* No old text exists. */
X      day_ptr->text = string;
X      day_ptr->freeable = freeable;
X   } else {
X      if (day_ptr->freeable) {
X         XtFree(day_ptr->text);
X      }
X      day_ptr->text = string;
X      day_ptr->freeable = freeable;
X   }
X}
X
X
X
X
X
Xchar * retrieve(date)
XDate date;
X{
X   year_entry * year_ptr = &head;
X   month_entry * month_ptr;
X   char * text_ptr;
X
X   while (year_ptr) {
X      if (year_ptr->year == date.year) {
X         month_ptr = year_ptr->month[date.month-1];
X         if (month_ptr) {
X            text_ptr = month_ptr->day[date.day-1].text;
X            if (text_ptr) {
X               return (text_ptr);
X            }
X            break;
X         }
X         break;
X      } else if (year_ptr->year > date.year) {
X         break;
X      }
X      year_ptr = year_ptr->next;
X   }
X   return EMPTYSTRING;
X}
X
X
X
X
Xint not_empty(string)
Xchar * string;
X{
X   /* Catch the null string. */
X   if (*string == NULL) {
X      return FALSE;
X   }
X
X   while (*string) {
X      if (!isspace(*string)) {
X         return TRUE;
X      }
X      string++;
X   }
X   return FALSE;
X}
X
X
X
X
X/* This is ugly.  Oh well. */
XDate next_entry(date)
XDate date;
X{
X   year_entry * year_ptr = &head;
X   month_entry * month_ptr;
X   char * text_ptr;
X   Date return_date;
X   int month;
X   int day;
X
X   while (year_ptr) {
X      if (year_ptr->year == date.year) {
X         /* Same year as date specified. */
X         for (month=date.month-1; month < 12; month++) {
X            month_ptr = year_ptr->month[month];
X            if (month_ptr) {
X               if (month == date.month-1) {
X                  /* Same month as date specified. */
X                  day = date.day;
X               } else {
X                  day = 0;
X               }
X               for (; day < 31; day++) {
X                  text_ptr = month_ptr->day[day].text;
X                  if (text_ptr && not_empty(text_ptr)) {
X                     return_date.year  = year_ptr->year;
X                     return_date.month = month+1;
X                     return_date.day   = day+1;
X                     return(return_date);
X                  }
X               }
X            }
X         }
X      } else if (year_ptr->year > date.year) {
X         for (month=0; month < 12; month++) {
X            month_ptr = year_ptr->month[month];
X            if (month_ptr) {
X               for (day=0; day < 31; day++) {
X                  text_ptr = month_ptr->day[day].text;
X                  if (text_ptr && not_empty(text_ptr)) {
X                     return_date.year  = year_ptr->year;
X                     return_date.month = month+1;
X                     return_date.day   = day+1;
X                     return(return_date);
X                  }
X               }
X            }
X         }
X      }
X      year_ptr = year_ptr->next;
X   }/*while*/
X
X   /* No entry following the specified date was found. */
X   return_date.year  = 0;
X   return_date.month = 0;
X   return_date.day   = 0;
X   return return_date;
X}
X
X
X
X/* This is ugly.  Oh well. */
XDate prev_entry(date)
XDate date;
X{
X   year_entry * year_ptr = &tail;
X   month_entry * month_ptr;
X   char * text_ptr;
X   Date return_date;
X   int month;
X   int day;
X
X   while (year_ptr) {
X      if (year_ptr->year == date.year) {
X         /* Same year as date specified. */
X         for (month=date.month-1; month >= 0; month--) {
X            month_ptr = year_ptr->month[month];
X            if (month_ptr) {
X               if (month == date.month-1) {
X                  /* Same month as date specified. */
X                  day = date.day-2;
X               } else {
X                  day = 30;
X               }
X               for (; day >= 0; day--) {
X                  text_ptr = month_ptr->day[day].text;
X                  if (text_ptr && not_empty(text_ptr)) {
X                     return_date.year  = year_ptr->year;
X                     return_date.month = month+1;
X                     return_date.day   = day+1;
X                     return(return_date);
X                  }
X               }
X            }
X         }
X      } else if (year_ptr->year < date.year) {
X         for (month=11; month >= 0; month--) {
X            month_ptr = year_ptr->month[month];
X            if (month_ptr) {
X               for (day=30; day >= 0; day--) {
X                  text_ptr = month_ptr->day[day].text;
X                  if (text_ptr && not_empty(text_ptr)) {
X                     return_date.year  = year_ptr->year;
X                     return_date.month = month+1;
X                     return_date.day   = day+1;
X                     return(return_date);
X                  }
X               }
X            }
X         }
X      }
X      year_ptr = year_ptr->prev;
X   }/*while*/
X
X   /* No entry following the specified date was found. */
X   return_date.year  = 0;
X   return_date.month = 0;
X   return_date.day   = 0;
X   return return_date;
X}
X
X
X
X
Xvoid save_diary(file_name)
Xchar * file_name;
X{
X   year_entry * year_ptr = &head;
X   month_entry * month_ptr;
X   char * text_ptr;
X   FILE * file;
X   int month;
X   int day;
X
X   file = fopen(file_name, "w");
X   if (!file) {
X      /*VARARGS*/
X      fprintf(stderr, "xdiary: fopen of file \"%s\" failed\n", file_name);
X      return;
X   }
X
X   while(year_ptr) {
X      for (month=0; month < 12; month++) {
X         month_ptr = year_ptr->month[month];
X         if (month_ptr) {
X            for (day=0; day < 31; day++) {
X               text_ptr = month_ptr->day[day].text;
X               if (text_ptr && not_empty(text_ptr)) {
X                  /*VARARGS*/
X                  fprintf(
X                     file,
X                     "%d/%d/%d\n",
X                     month+1, day+1, year_ptr->year
X                  );
X                  putc(QUOTE, file);
X                  while (*text_ptr) {
X                     putc(*text_ptr, file);
X                     if (*text_ptr == QUOTE) {
X                        putc(QUOTE, file);
X                     }
X                     text_ptr++;
X                  }
X                  putc(QUOTE, file);
X                  putc(NEWLINE, file);
X                  putc(NEWLINE, file);
X               }
X            }
X         }
X      }
X      year_ptr = year_ptr->next;
X   }/*while*/
X
X   fclose(file);
X}
X
X
X
X
X
X#define parse_error(str) \
X   (/*VARARGS*/fprintf( \
X      stderr, \
X      "xdiary: file \"%s\", line %d: %s\n", \
X      file_name, \
X      current_line, \
X      (str) \
X   ))
X
Xint init_diary(file_name)
Xchar * file_name;
X{
X   char * file = read_diary(file_name);
X   char * fileptr = &file[0];
X   char * start_of_string = fileptr;
X   char * end_of_string = fileptr;
X   int parsing_date = FALSE;
X   int parsing_string = FALSE;
X   int current_line = 1;
X   int token_last_seen = STRING;
X   Date date;
X
X   /* Initialize the head and tail to simplify everything. */
X   tail.year = MAXINT;
X   tail.next = NULL;
X   tail.prev = &head;
X
X   head.year = 0;
X   head.next = &tail;
X   head.prev = NULL;
X   
X   if (!file) {
X      /*VARARGS*/
X      fprintf(stderr, "xdiary: file \"%s\" will be created\n", file_name);
X      return FALSE;
X   }
X
X   while ((int)*fileptr != EOF) {
X      switch (*fileptr) {
X         case QUOTE:
X            if (parsing_string) {
X               if (fileptr[1] == QUOTE) {
X                  /* Change two quotes to one. */
X                  *end_of_string = QUOTE;
X                  end_of_string++;
X                  fileptr++;
X               } else {
X                  /* End of string. */
X                  *end_of_string = 0;
X                  parsing_string = FALSE;
X                  if (token_last_seen == STRING) {
X                     parse_error("date missing");
X                  } else {
X                     install(date, start_of_string, FALSE);
X                  }
X                  token_last_seen = STRING;
X                  start_of_string = end_of_string = fileptr + 1;
X               }
X            } else {
X               /* Must be the start of a new string. */
X               parsing_string = TRUE;
X               start_of_string = end_of_string = fileptr + 1;
X            }
X            break;
X         case NEWLINE:
X            if (parsing_date) {
X               /* Finished parsing a date. */
X               parsing_date = FALSE;
X               *end_of_string = 0;
X               if (token_last_seen == DATE) {
X                  parse_error("text missing");
X               }
X               token_last_seen = DATE;
X               date = convert_string_to_date(
X                         default_month_names,
X                         start_of_string
X                      );
X               if (date.year == 0) {
X                  parse_error("bad date");
X                  token_last_seen = STRING;
X               }
X            } else if (parsing_string) {
X               /* Newline is part of a string. */
X               *end_of_string = *fileptr;
X               end_of_string++;
X            }
X            current_line++;
X            break;
X         default:
X            if (parsing_date || parsing_string) {
X               /* Part of string. */
X               *end_of_string = *fileptr;
X               end_of_string++;
X            } else {
X               /* If character is signigicant, start parsing date. */
X               if (!isspace(*fileptr)) {
X                  parsing_date = TRUE;
X                  end_of_string = start_of_string = fileptr;
X                  end_of_string++;
X               }
X            }
X      }/*switch*/
X      fileptr++;
X   }
X   return TRUE;
X}
X
X
X
X
X
X#ifdef DEBUG
Xvoid dump_dairy()
X{
X   year_entry * year_ptr = &head;
X   int month;
X   int day;
X
X   while(year_ptr) {
X      for (month=0; month < 12; month++) {
X         if (year_ptr->month[month]) {
X            for (day=0; day < 31; day++) {
X               if (year_ptr->month[month]->day[day].text) {
X                  /*VARARGS*/
X                  printf(
X                     "date=%d/%d/%d\nfreeable=%d\ntext=\"%s\"\n",
X                     year_ptr->year, month, day,
X                     year_ptr->month[month]->day[day].freeable,
X                     year_ptr->month[month]->day[day].text
X                  );
X               }
X            }
X         }
X      }
X      year_ptr = year_ptr->next;
X   }/*while*/
X}
X#endif
END_OF_FILE
if test 15472 -ne `wc -c <'diary.c'`; then
    echo shar: \"'diary.c'\" unpacked with wrong size!
fi
# end of 'diary.c'
fi
if test -f 'xdiary.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xdiary.man'\"
else
echo shar: Extracting \"'xdiary.man'\" \(16326 characters\)
sed "s/^X//" >'xdiary.man' <<'END_OF_FILE'
X.TH xdiary 1 "Release 4" "X Version 11"
X.SH NAME
X\fIxdiary\fP \- interactive diary and calendar for X11 R4
X.SH SYNTAX
X\fIxdiary\fP [options]
X.SH DESCRIPTION
X\fIxdiary\fP is an X application that displays a calendar in one of two
Xformats and/or an interactive daily diary.
X.SH OPTIONS
X\fIxdiary\fP accepts all of the standard toolkit command line options along
Xwith the following:
X.IP "\fB-linewidth\fP \fIpixels\fP" 12
XThis option indicates how many pixels wide the lines composing the
Xcalendar grid should be.  By default, the grid lines are one pixel wide.
X.IP "\fB-fullgeometry\fP \fIgeometry\fP" 12
XThis option indicates the geometry to be used when determining the
Xsize and position of the full year calendar.  The full year
Xcalendar will default to the minimum size needed to hold calendars
Xfor all twelve months based on the specified font,
Xabbreviation, and language options.
X.IP "\fB-singlegeometry\fP \fIgeometry\fP" 12
XThis option indicates the geometry to be used when determining the
Xsize and position of the single month calendar.  The single month
Xcalendar will default to the minimum size needed to hold a calendar
Xfor a single month based on the specified font, abbreviation,
Xand language options.
X.IP "\fB-diarygeometry\fP \fIgeometry\fP" 12
XThis option indicates the geometry to be used when determining the
Xsize and position of the diary.
X.IP "\fB-digitfont\fP \fIfont-name\fP" 12
XThis option indicates the font to be used for the digits that will
Xappear in the calendar cells.
X.IP "\fB-weekdayfont\fP \fIfont-name\fP" 12
XThis option indicates the font to be used for the weekday names
Xthat will appear above each column of cells in the calendar.
X.IP "\fB-titlefont\fP \fIfont-name\fP" 12
XThis option indicates the font to be used for the calendar
Xtitle(s) that will appear above each calendar specifying the
Xcalendar's month and year.
X.IP "\fB-digitgravity\fP \fIgravity\fP" 12
XThis option indicates the placement of the digits within the cells
Xof the calendars, where \fIgravity\fP is one of the following:
X.IP
XNorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast
X.IP "\fB-startingweekday\fP \fIday-name\fP" 12
XThis option indicates which day of the week should correspond to
Xthe days in the left-most column of the calendar.  Sunday is the
Xdefault.
X.IP "\fB-language\fP \fIlanguage-name\fP" 12
XThis option indicates what language the calendar should display
Xall of its text in.  Currently  English, Spanish, French, and
XGerman are available.  Be sure to specify fonts with complete
XLatin-1 character specifications when specifying foreign languages.
X.IP "\fB-diaryfile\fP \fIdiary-filename\fP" 12
XThis option indicates the filename that will be used to read the
Xdiary daily information from.  Any changes to the diary will be
Xsaved to this file when the save or quit menu option is selected.
XBy default, the file ~/.xdiary will be used.
X.IP "\fB-templatefile\fP \fItemplate-filename\fP" 12
XThis option indicates the filename that will be used to read the diary entry
Xtemplate from.  By default, the file ~/.xdiary-template will be used.
XIf that file does not exist and if this option is not specified, then no diary
Xentry template will be used.
X.IP \fB-nocalendar\fP 12
XThis option indicates that upon startup no calendar is to be
Xdisplayed along with the diary.  By default, a calendar will be displayed.
X.IP \fB-nodiary\fP 12
XThis option indicates that upon startup no diary is to be
Xdisplayed along with the calendar.  By default, a diary will be displayed.
X.IP "\fB-abbrev\fP \fIcount\fP" 12
XThis option indicates that the weekday names that will appear
Xabove each column in the calendar(s) should be abbreviated to \fIcount\fP
Xcharacters.  By default, weekday names will be abbreviated to three characters.
X.IP \fB-long\fP 12
XThis option indicates that the weekday names that will appear
Xabove each column in the calendar(s) should not be abbreviated.
X.IP \fB-fullyear\fP 12
XThis option indicates that a full year calendar is to be
Xdisplayed.
X.IP \fB-singlemonth\fP 12
XThis option indicates that only a single month calendar is to be
Xdisplayed.  This is true by default.
X.IP \fIdate-string\fP 12
XA string specifying the date for the calendar and diary to display
Xupon startup.  If no string is specified, the current date is
Xused.  The string may be completely numeric or it may contain a
Xmonth name.  However, if a language option is specified, the month
Xname must be in the specified language.
X.IP
XSeveral formats are accepted, as well as incomplete dates:
X.nf
X.IP
X	9/17/66
X	17.9.66
X	Sep 17, 1966
X	17 september 66
X	Sept 66
X	1966
X.fi
X.PP
XCase is ignored and non-ambiguous abbreviations for the options and
Xarguments are accepted.
X.SH OPERATION
XThe diary and calendar are intended to be as intuitive to use as
Xpossible.  
X.PP
XThe \fBday\fP backward and forward arrows make the calendar and diary
Xdisplay the previous day and next day respectively.
X.PP
XThe \fBmonth\fP backward and forward arrows make the calendar display the
Xprevious month and next month respectively.  However, the diary
Xremains unchanged.
X.PP
XThe \fByear\fP backward and forward arrows make the calendar display the
Xprevious year and next year respectively.  However, the diary remains
Xunchanged.
X.PP
XThe \fBentry\fP backward and forward arrows make the diary display the
Xprevious entry and next entry respectively.  The calendar is kept in
Xsync with the current diary entry.
X.PP
XThe pointer may be used to select any date on the calendar that is
Xcurrently visible.  The diary will then display the entry (if any)
Xfor the selected date.
X.PP
XWhen the pointer is in the diary text window, any text typed will
Xbecome part of the diary entry for the currently displayed date.
X.PP
XClicking on the \fBoption\fP button will pull down a menu with the
Xfollowing selections:
X.IP \fBToday\fP 12
XMake the calendar display today's date and make the diary display
Xthe corresponding diary entry.
X.IP \fBWarp\fP 12
XPops up a dialog box and enables the user to type in a date for
Xthe calendar and diary to display.  The format of this date is
Xidentical to that of the \fIdate-string\fP described above.  Any month
Xstrings must be in the language specified.  Pressing the return
Xkey terminates input.  Bogus dates will be quietly ignored.
X.IP \fBDiary\fP 12
XHides the diary.  If the \fB-nodiary\fP command line option was
Xspecified, or if the diary has already been hidden, this option
Xbrings the diary back into view.
X.IP \fBFull\fP 12
XChange the calendar to a full year calendar.  If the full year
Xcalendar is currently being displayed, this option hides the full
Xyear calendar so that only the diary is visible.  If the \fB-nocalendar\fP
Xoption was specified, or if the full year calendar is currently hidden, then
Xthe full year calendar may be brought into view by selecting this menu
Xitem.
X.IP \fBSingle\fP 12
XChange the calendar to a single month calendar.  If the single
Xmonth calendar is currently being displayed, this option hides the
Xsingle month calendar so that only the diary is visible.  If the \fB-nocalendar\fP
Xoption was specified, or if the single month calendar is currently hidden, then
Xthe single month calendar may be brought into view by selecting this menu
Xitem.
X.IP \fBSave\fP 12
XSave the diary changes made during this session (if any) in the
Xdiary file.
X.IP \fBQuit\fP 12
XExit the \fIxdiary\fP application.  If the contents of the diary have
Xnot been saved, they will be saved before the application exits.
X.SH TEMPLATES
XA template is an ascii file whose contents will be used for any diary entry
Xthat did not exist prior to the invocation of the \fIxdiary\fP application.
X.PP
XTemplates allow you to customize the format of the diary entries.  For
Xexample, a template file could be created with the following contents:
X.PP
X.nf
X\fL	 7:00
X	 8:00
X	 9:00
X	10:00
X	11:00
X	 noon
X	 1:00
X	 2:00
X	 3:00
X	 4:00
X	 5:00\fP
X.fi
X.PP
XThe above template would be useful for appointment scheduling and time
Xmanagement whereas the following template would be useful for logging work:
X.PP
X.nf
X\fL	Things to do today:
X	1.
X	2.
X	3.
X
X	Things done today:
X	1.
X	2.
X	3.\fP
X.fi
X.PP
XOnce text is added to the template, the template becomes part of the diary
Xentry and can be edited for further customization.
X.PP
XIf no template file is specified, and if the file ~/.xdiary-template does not
Xexist, then all diary entries that did not exist prior
Xto the invocation of the \fIxdiary\fP application will initially be empty.
X.SH DIARY FILE FORMAT
XThe format chosen for the diary file is very simple so that it is
Xpossible to delete, add or change diary entries easily from a text
Xeditor.  The entry format is a newline terminated date string
Xfollowed by a newline terminated double quote enclosed information
Xstring.  Double quotes within the information string are
Xallowed, but they must be doubled (i.e. "").  A series of these
Xentries make up the diary file.
X.PP
XThe following two diary entries illustrate the format of the diary file:
X.PP
X.nf
X	9/17/1966
X	"Meeting with Steve and Sally went as expected."
X.PP
X	9/18/1966
X	"Dave said, ""Buy stock in IBM.""  I can't
X	wait to make him eat his own words."
X.fi
X.PP
XThe entries may initially appear in any order, however they are
Xalways saved in ascending order by the \fIxdiary\fP application.
X.SH CUSTOMIZATION
XThe \fIxdiary\fP application class name is Xdiary.
X.PP
X\fIxdiary\fP has a small application defaults file which is used simply to
Xselect default fonts and to configure the text widget used by the diary.
X.PP
XThe \fIxdiary\fP application is divided into three independent parts:
X.IP xdiary.full
XThis references the top level window of the full year calendar part.
X.IP xdiary.single
XThis references the top level window of the single month calendar
Xpart.
X.IP xdiary.diary
XThis references the top level window of the diary calendar part.
X.PP
XThe full and single calendar parts have a large number of resources
Xwhich can be specified to customize their appearance.
X.PP
XThe diary's appearance can also be customized.  In addition, the text
Xwidget has few hard coded resources and can be customized in many ways.
X.PP
X.SH WIDGET HIERARCHY
XIn order to specify resources, it is useful to know the hierarchy of the
Xwidgets which compose \fIxdiary\fP.  In the notation below, indentation
Xindicates hierarchical structure.  The widget class name is given first,
Xfollowed by the widget instance name.
X.PP
X.nf
XXdiary xdiary
X   Shell single
X      Paned paned
X         ButtonBox buttons
X            MenuButton option
X            Form form
X               Label month
X               Command dec
X               Command inc
X            Form form
X               Label year
X               Command dec
X               Command inc
X         Form form
X            Calendar calendar
X   Shell full
X      Paned paned
X         ButtonBox buttons
X            MenuButton option
X            Form form
X               Label year
X               Command dec
X               Command inc
X         Form form
X            Calendar january
X            Calendar february
X            Calendar march
X            Calendar april
X            Calendar may
X            Calendar june
X            Calendar july
X            Calendar august
X            Calendar september
X            Calendar october
X            Calendar november
X            Calendar december
X   Shell diary
X      Paned paned
X         ButtonBox buttons
X            MenuButton option
X            Form form
X               Label day
X               Command dec
X               Command inc
X            Form form
X               Label entry
X               Command dec
X               Command inc
X            Label label
X         Form form
X            AsciiText text
X.fi
X.SH APPLICATION RESOURCES
XResources that reflect command line options:
X.PP
X.IP "xdiary*noCalendar: \fIBoolean\fP"
XSame as the \fB-nocalendar\fP option.
X.IP "xdiary*noDiary: \fIBoolean\fP"
XSame as the \fB-nodiary\fP option.
X.IP "xdiary*language: \fILanguage\fP"
XSame as the \fB-language\fP option.
X.IP "xdiary*abbrev: \fIInteger\fP"
XSame as the \fB-abbrev\fP option.
X.IP "xdiary*long: \fIBoolean\fP"
XSame as the \fB-long\fP option.
X.IP "xdiary*diaryFile: \fIFilename\fP"
XSame as the \fB-diaryfile\fP option.
X.IP "xdiary*templateFile: \fIFilename\fP"
XSame as the \fB-templatefile\fP option.
X.IP "xdiary*fullYear: \fIBoolean\fP"
XSame as the \fB-fullyear\fP option.
X.IP "xdiary*singleMonth: \fIBoolean\fP"
XSame as the \fB-singlemonth\fP option.
X.IP "xdiary*Calendar*lineWidth: \fIInteger\fP"
XSame as the \fB-linewidth\fP option.
X.IP "xdiary*full*geometry: \fIGeometry\fP"
XSame as the \fB-fullgeometry\fP option.
X.IP "xdiary*single*geometry: \fIGeometry\fP"
XSame as the \fB-singlegeometry\fP option.
X.IP "xdiary*diary*geometry: \fIGeometry\fP"
XSame as the \fB-diarygeometry\fP option.
X.IP "xdiary*single*digitFont: \fIFont\fP"
XSame as the \fB-digitfont\fP option.
X.IP "xdiary*single*weekdayFont: \fIFont\fP"
XSame as the \fB-weekdayfont\fP option.
X.IP "xdiary*single*titleFont: \fIFont\fP"
XSame as the \fB-titlefont\fP option.
X.IP "xdiary*digitGravity: \fIGravity\fP"
XSame as the \fB-digitgravity\fP option.
X.IP "xdiary*startingWeekday: \fIWeekday\fP"
XSame as the \fB-startingweekday\fP option.
X.PP
XThe following resources may be specified in a resource file as a comma
Xseparated list of quoted strings:
X.IP "xdiary*Calendar*weekdayNames: \fIStringTable\fP"
XSpecify the names of the weekdays to be used in the calendar(s).
XSeven strings must be specified.  When specifying weekday names as
Xa resource, the \fB-language\fP, \fB-long\fP, and \fB-abbrev\fP
Xoptions must not be specified.
X.IP "xdiary*Calendar*monthNames: \fIStringTable\fP"
XSpecify the names of the months to be used in the calendar(s).
XTwelve strings must be specified.
X.IP "xdiary*Calendar*digitNames: \fIStringTable\fP"
XSpecify the names of the digits to be used in the calendar(s).
XThrity-one strings must be specified.  Added mostly for orthogonality,
Xbut could be used to specify characters in a specialized calendar
Xfont or to specify Roman numerals, etc.
X.SH FILES
X.IP ~/.xdiary
XThe default diary file.
X.IP ~/.xdiary-template
XThe default template file.
X.IP/usr/lib/X11/app-defaults/Xdiary
XThe application defaults resource file.
X.SH SEE ALSO
XX(1), xrdb(1), the Athena Widget Set, Calendar.doc
X.SH DIAGNOSTICS
X\fIxdiary\fP attempts to recover from syntax errors in the diary file, however
Xthere's no limit to the number of error messages produced so feeding it an
Xentirely bogus file is not recommended.
X.PP
XSpecifying fonts that do not exist will result in an X Protocol BadName
Xfatal error.
X.SH BUGS
X\fIxdiary\fP doesn't do any file locking, so if multiple \fIxdiaries\fP are
Xrunning based off the same diary file, the last one to save its diary wins.
X.PP
XThe diary entries in the diary file do not append, therefore the last
Xentry with a given date will replace any previous entries with the same
Xdate, and the previous entries will be lost after \fIxdiary\fP saves the diary
X(if any changes have been made).  This is only a problem if the diary
Xfile is edited by a text editor other than the one provided by \fIxdiary\fP.
X.SH COPYRIGHT
XCopyright 1990 Harris Corporation
X.PP
XPermission to use, copy, modify, and distribute, this software and its
Xdocumentation for any purpose is hereby granted without fee, provided that
Xthe above copyright notice appear in all copies and that both that
Xcopyright notice and this permission notice appear in supporting
Xdocumentation, and that the name of the copyright holder be used in
Xadvertising or publicity pertaining to distribution of the software with
Xspecific, written prior permission, and that no fee is charged for further
Xdistribution of this software, or any modifications thereof.  The copyright
Xholder makes no representations about the suitability of this software for
Xany purpose.  It is provided "as is" without express or implied warranty.
X.PP
XTHE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
XINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND IN NO
XEVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
XCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ITS USE,
XLOSS OF DATA, PROFITS, QPA OR GPA, WHETHER IN AN ACTION OF CONTRACT,
XNEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
XTHE USE OR PERFORMANCE OF THIS SOFTWARE.
X.SH AUTHOR
X.nf
XJason Baietto
Xjason at ssd.csd.harris.com
END_OF_FILE
if test 16326 -ne `wc -c <'xdiary.man'`; then
    echo shar: \"'xdiary.man'\" unpacked with wrong size!
fi
# end of 'xdiary.man'
fi
echo shar: End of archive 3 \(of 5\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 4 5 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 5 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

-- 
|===================================|===================================|
|      Jason "Jasper" Baietto       |       otteiaB "repsaJ" nosaJ      |
| Harris Computer Systems Division  |  noisiviD smetsyS retupmoC sirraH |
|     Fort Lauderdale, Florida      |      adirolF ,eladreduaL troF     |
|   jason at hcx2.ssd.csd.harris.com   |   moc.sirrah.dsc.dss.2xch at nosaj   |
|===================================|===================================|



More information about the Alt.sources mailing list