home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-11-10 | 37.5 KB | 1,087 lines |
- Newsgroups: comp.sources.misc
- From: dfs@doe.carleton.ca (David F. Skoll)
- Subject: v33i058: remind - A replacement for calendar, Part01/12
- Message-ID: <csm-v33i058=remind.221714@sparky.IMD.Sterling.COM>
- X-Md4-Signature: 76d802448c6ebd7608dd2dd15c916b3d
- Date: Tue, 10 Nov 1992 04:17:39 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: dfs@doe.carleton.ca (David F. Skoll)
- Posting-number: Volume 33, Issue 58
- Archive-name: remind/part01
- Environment: UNIX, MS-DOS
- Supersedes: remind: Volume 17, Issue 3-6
-
- NOTE: If you got Remind via ftp from ftp.doe.carleton.ca before 9
- November, 1992, you have a BETA version WITH BUGS. Throw it out!!
-
- Remind is a sophisticated reminder program. It has a flexible and
- powerful script language, and allows you to easily specify reminders
- for most occasions. For example, you can easily specify:
-
- - Particular dates (birthdays, etc.)
- - Holidays like Labour day, which occur on a particular
- weekday of a month.
- - Dates which repeat with an arbitrary period
- - Meetings which are automatically moved in the event of holidays.
- - etc.
-
- Remind also includes a feature to activate timed "alarms" in the
- background.
-
- Remind should work on most Un*x systems, as well as MS-DOS. This allows
- you to use the same script on your Un*x and MS-DOS systems.
-
- FTP sites:
-
- You can get Remind from ftp.doe.carleton.ca in the pub directory. The
- files are:
-
- Entire source distribution: remind-3.0.0.tar.Z
- MSDOS executable: remind.exe
- Man page in plain text: remind.man
- Postscript man page: remind.ps
-
- Thanks to Dennis Cottel and Bill Silvert, who beta-tested Remind for me.
-
- David F. Skoll
- -------------------
- #!/bin/sh
- # This is Remind 03.00.00, a shell archive (shar 3.32)
- # made 11/09/1992 20:20 UTC by dfs@ro
- # Source directory /enterprise/turbolift/dfs/work/.rem/Remind-3.0/work
- #
- # existing files will NOT be overwritten
- #
- # This shar contains:
- # length mode name
- # ------ ---------- ------------------------------------------
- # 1685 -rw------- README.UNIX
- # 438 -rw------- README.DOS
- # 2732 -rw------- COPYRIGHT
- # 7694 -rw------- config.h
- # 3591 -rw------- err.h
- # 1010 -rw------- expr.h
- # 3561 -rw------- globals.h
- # 4850 -rw------- protos.h
- # 3594 -rw------- types.h
- # 688 -rw------- version.h
- # 22448 -rw------- calendar.c
- # 14531 -rw------- dorem.c
- # 9144 -rw------- dosubst.c
- # 36192 -rw------- expr.c
- # 14553 -rw------- files.c
- # 41381 -rw------- funcs.c
- # 1011 -rw------- globals.c
- # 9425 -rw------- init.c
- # 30576 -rw------- main.c
- # 11727 -rw------- omit.c
- # 9705 -rw------- queue.c
- # 8965 -rw------- token.c
- # 13395 -rw------- trigger.c
- # 10178 -rw------- userfns.c
- # 6948 -rw------- utils.c
- # 11570 -rw------- var.c
- # 2669 -rw------- Makefile
- # 850 -rw------- rem
- # 772 -rw------- rem.1
- # 71460 -rw------- remind.1
- # 1446 -rw------- remind-all.csh
- # 1472 -rw------- remind-all.sh
- # 4821 -rw------- test.rem
- # 384 -rwx------ test-rem
- # 12909 -rw------- test.cmp
- # 1426 -rw------- makefile.tc
- # 1339 -rw------- makefile.msc
- # 201 -rw------- lnk.msc
- # 168 -rw------- lnk.tc
- # 399 -rw------- MANIFEST.UNX
- # 393 -rw------- MANIFEST.DOS
- # 3329 -rw------- WHATSNEW.30
- # 852 -rwx------ kall
- # 679 -rw------- kall.1
- #
- if touch 2>&1 | fgrep 'amc' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- # ============= README.UNIX ==============
- if test X"$1" != X"-c" -a -f 'README.UNIX'; then
- echo "File already exists: skipping 'README.UNIX'"
- else
- echo "x - extracting README.UNIX (Text)"
- sed 's/^X//' << 'SHAR_EOF' > README.UNIX &&
- XREMIND version 3.0 for UNIX
- X
- X1 - Read the file COPYRIGHT.
- X
- X2- Before compiling the software, check to see if it includes patches.
- X These are files called patch.xx. If there are patches, apply them all
- X by typing:
- X
- X cat patch.* | patch
- X
- X3 - Examine the Makefile and change any parameters which need to be
- X changed for your system. As it stands, the Makefile is set up for a
- X BSD system.
- X
- X4 - Examine the file config.h and adjust parameters as needed
- X
- X5 - Type 'make'
- X
- X6 - Type 'test-rem' to run the acceptance test
- X
- X7 - Copy the remind executable to the appropriate directory, and copy
- X the man page to the man directory.
- X
- XTwo shell scripts, "remind-all.csh" and "remind-all.sh" are provided.
- XThese allow automatic mailing of reminders to all users who create a
- X$HOME/.reminders file. These two scripts are equivalent; one is a
- X"sh" script and the other is a "csh" script. Pick the one you want to
- Xuse, and follow the instructions in the opening comments of the
- Xscript.
- X
- X*** NOTE *** Please be aware that "remind-all.csh" and "remind-all.sh"
- Xhave been changed since the last release of Remind. If you install
- Xthe new remind executable, make sure you switch over to the new
- X"remind-all" scripts.
- X
- XA shell script called "rem" is provided for those who like to have
- X'remind' assume a default reminders file. A man page for this script
- Xis provided. You should examine the script to ensure that the defaults
- Xare correct.
- X
- XA shell script called "kall" is provided so you can kill your background
- Xremind processes when you log out. See the man page. Note that kall
- Xdepends on the output of "ps", and may not be portable.
- X
- X--
- XDavid F. Skoll <dfs@doe.carleton.ca>
- SHAR_EOF
- $TOUCH -am 1109141292 README.UNIX &&
- chmod 0600 README.UNIX ||
- echo "restore of README.UNIX failed"
- set `wc -c README.UNIX`;Wc_c=$1
- if test "$Wc_c" != "1685"; then
- echo original size 1685, current size $Wc_c
- fi
- fi
- # ============= README.DOS ==============
- if test X"$1" != X"-c" -a -f 'README.DOS'; then
- echo "File already exists: skipping 'README.DOS'"
- else
- echo "x - extracting README.DOS (Text)"
- sed 's/^X//' << 'SHAR_EOF' > README.DOS &&
- XREMIND version 3.0 for MS-DOS
- X
- X1 - Read the file COPYRIGHT. (This may be called COPYRIGH on your
- X MS-DOS system.)
- X
- X2 - Examine the file config.h and adjust parameters as needed
- X
- X3 - If you are using Turbo C to compile Remind, type:
- X
- X make -fmakefile.tc
- X
- X If you are using Microsoft C to compile Remind, type:
- X
- X make makefile.msc
- X
- XThis will create REMIND.EXE, which is ready to be executed.
- X
- X--
- XDavid F. Skoll <dfs@doe.carleton.ca>
- SHAR_EOF
- $TOUCH -am 1109141292 README.DOS &&
- chmod 0600 README.DOS ||
- echo "restore of README.DOS failed"
- set `wc -c README.DOS`;Wc_c=$1
- if test "$Wc_c" != "438"; then
- echo original size 438, current size $Wc_c
- fi
- fi
- # ============= COPYRIGHT ==============
- if test X"$1" != X"-c" -a -f 'COPYRIGHT'; then
- echo "File already exists: skipping 'COPYRIGHT'"
- else
- echo "x - extracting COPYRIGHT (Text)"
- sed 's/^X//' << 'SHAR_EOF' > COPYRIGHT &&
- XTHE REMIND COPYRIGHT
- X
- XREMIND refers to the entire set of files and documentation in the
- XREMIND package.
- X
- XREMIND is Copyright 1990, 1991, 1992 by David Skoll, except for the
- Xfile remind-all.sh, which is Copyright 1990 by Bill Aten.
- X
- XYou may use REMIND for free, and may freely distribute it, providing
- Xyou do not charge the recipients to whom you distribute REMIND.
- X
- XYou may modify REMIND. However, you must clearly indicate such
- Xmodifications when you distribute REMIND, and must tell the recipients
- Xof the modified version that it is modified. Place that notice in the
- XWHATSNEW.xx file.
- X
- XYou may incorporate parts of REMIND into your own programs, providing
- Xyou do not sell these programs. You must clearly indicate that the
- Xparts of REMIND you have incorporated are Copyright 1990, 1991, 1992
- Xby David Skoll.
- X
- XI will attempt to support REMIND as much as possible. However, you
- Xuse it at your own risk. I am not responsible for any damages caused
- Xby the use or misuse of REMIND.
- X
- XIf you wish to contribute ideas or money to help the production of
- Xsoftware like REMIND, you can reply to the address shown at the end of
- Xthis file. Note that you are under no obligation to send me money.
- XIf you don't donate, you have full rights to use REMIND just as if you
- Xhad donated. If you do donate, you get a big thank-you, but no
- Xspecial rights. However, you will have helped support the production
- Xof software like REMIND. Should you wish to donate, the suggested
- Xamount is $18.00 (Canadian)
- X
- XACKNOWLEDGEMENTS:
- X
- XI would like to thank the following people:
- X
- XBill Aten <netagw!bill@uunet.UU.NET> for providing remind-all.sh
- X
- XBradley D. Keister <keister@poincare.phys.cmu.edu>, Rhys Weatherly
- Xrhys@batserver.cs.uq.OZ.AU> and Anthony Cheng for initially providing
- Xthe Turbo C compiler support.
- X
- XDennis Cottel <dennis@peanuts.nosc.mil> for providing the patch to
- Xproduce calendars by weeks as well as by months.
- X
- XBill Silvert <bill%biomel@cs.dal.ca> and Dennis Cottel
- X<dennis@peanuts.nosc.mil> for suggesting many of the new features in
- XREMIND.
- X
- XDave Wolfe <dwolfe@pffft.sps.mot.com> and Raphael Manfredi
- X<ram@eiffel.com> for noticing bugs and sending me fixes.
- X
- XTimo Salmi, Keith Petersen, Bill Davidsen and Kent Landfield for
- Xmaintaining the uwasa and SIMTEL archives, and comp.binaries.ibm.pc
- Xand comp.sources.misc in the face of a flurry of updates to REMIND.
- X
- XAll others who have corresponded with me to report bugs, express
- Xappreciation or suggest features - too many people to list here.
- X
- XFinally, all those who donated money to support the production of
- XREMIND. Your donations were gratefully appreciated.
- X
- X--
- XDavid F. Skoll <dfs@doe.carleton.ca>
- X4-317 LeBreton Street South
- XOttawa, Ontario K1S 4L4
- XCANADA
- X
- XTel. (613) 567-3662
- X
- SHAR_EOF
- $TOUCH -am 1109141292 COPYRIGHT &&
- chmod 0600 COPYRIGHT ||
- echo "restore of COPYRIGHT failed"
- set `wc -c COPYRIGHT`;Wc_c=$1
- if test "$Wc_c" != "2732"; then
- echo original size 2732, current size $Wc_c
- fi
- fi
- # ============= config.h ==============
- if test X"$1" != X"-c" -a -f 'config.h'; then
- echo "File already exists: skipping 'config.h'"
- else
- echo "x - extracting config.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > config.h &&
- X/***************************************************************/
- X/* */
- X/* CONFIG.H */
- X/* */
- X/* Contains various configuration parameters for Remind. */
- X/* You may have to edit this file to tweak parameters or take */
- X/* care of certain system dependencies. */
- X/* */
- X/* This file is part of REMIND. */
- X/* Copyright (C) 1991 by David F. Skoll. */
- X/* */
- X/***************************************************************/
- X
- X/*---------------------------------------------------------------------*/
- X/* STRSTR: If your system does not have the "strstr" function, */
- X/* uncomment the following line. */
- X/*---------------------------------------------------------------------*/
- X/* #define NO_STRSTR 1 */
- X
- X/*---------------------------------------------------------------------*/
- X/* STDLIB: If you don't have the <stdlib.h> header file, comment the */
- X/* following line. */
- X/*---------------------------------------------------------------------*/
- X#define HAVE_STDLIB_H 1
- X
- X/*---------------------------------------------------------------------*/
- X/* MALLOC: If you do not have the <malloc.h> header file, */
- X/* comment out the next 3 lines. */
- X/*---------------------------------------------------------------------*/
- X#ifdef UNIX
- X#define HAVE_MALLOC_H 1
- X#endif
- X
- X/*---------------------------------------------------------------------*/
- X/* BASE: The base year for date calculation. NOTE! January 1 of the */
- X/* base year MUST be a Monday, else Remind will not work! */
- X/*---------------------------------------------------------------------*/
- X#define BASE 1990
- X
- X/*---------------------------------------------------------------------*/
- X/* YR_RANGE: The range of years allowed. Computers with 16-bit */
- X/* integers can handle about 89 years worth of reminders; if */
- X/* you use 32-bit integers, you can handle over 5 867 000 */
- X/* years. Note that YR_RANGE is set to 88 rather than 89 */
- X/* because we can range up to the last day of the 88th year. */
- X/*---------------------------------------------------------------------*/
- X#define YR_RANGE 88
- X
- X/*---------------------------------------------------------------------*/
- X/* VAR_NAME_LEN: The maximum length of variable names */
- X/*---------------------------------------------------------------------*/
- X#define VAR_NAME_LEN 12
- X
- X/*---------------------------------------------------------------------*/
- X/* MAX_PRT_LEN: The maximum number of characters to print when */
- X/* displaying a string value for debugging purposes. */
- X/*---------------------------------------------------------------------*/
- X#define MAX_PRT_LEN 40
- X
- X/*---------------------------------------------------------------------*/
- X/* LINELEN: The maximum length of an input line */
- X/*---------------------------------------------------------------------*/
- X#define LINELEN 512
- X
- X/*---------------------------------------------------------------------*/
- X/* OP_STACK_SIZE: The size of the operator stack for expr. parsing */
- X/*---------------------------------------------------------------------*/
- X#define OP_STACK_SIZE 30
- X
- X/*---------------------------------------------------------------------*/
- X/* VAL_STACK_SIZE: The size of the operand stack for expr. parsing */
- X/*---------------------------------------------------------------------*/
- X#define VAL_STACK_SIZE 30
- X
- X/*---------------------------------------------------------------------*/
- X/* INCLUDE_NEST: How many nested INCLUDES do we handle? */
- X/*---------------------------------------------------------------------*/
- X#define INCLUDE_NEST 8
- X
- X/*---------------------------------------------------------------------*/
- X/* IF_NEST: How many nested IFs do we handle? Maximum is the number */
- X/* of bits in an int, divided by two. Beware! */
- X/*---------------------------------------------------------------------*/
- X#define IF_NEST (4*sizeof(unsigned int))
- X
- X/*---------------------------------------------------------------------*/
- X/* Do we handle queued reminders? */
- X/*---------------------------------------------------------------------*/
- X#ifdef UNIX
- X#define HAVE_QUEUED 1
- X#endif
- X
- X/*---------------------------------------------------------------------*/
- X/* Does our C compiler have prototypes? Override this test if you */
- X/* are using a non-ANSI compiler that nevertheless has prototypes. */
- X/*---------------------------------------------------------------------*/
- X#ifdef __STDC__
- X#define HAVE_PROTOS 1
- X#endif
- X
- X/*---------------------------------------------------------------------*/
- X/* Do we use the <stdarg.h> scheme for functions with variable number */
- X/* of parameters? If not, the <varargs.h> scheme is assumed. */
- X/*---------------------------------------------------------------------*/
- X#ifdef __STDC__
- X#define HAVE_STDARG 1
- X#endif
- X
- X/*---------------------------------------------------------------------*/
- X/* Do we have the <unistd.h> header? If not, use sys/files.h */
- X/*---------------------------------------------------------------------*/
- X#define HAVE_UNISTD 1
- X
- X/*---------------------------------------------------------------------*/
- X/* How many attempts to resolve a weird date spec? */
- X/*---------------------------------------------------------------------*/
- X#define TRIG_ATTEMPTS 25
- X
- X/*---------------------------------------------------------------------*/
- X/* How many global omits of the form YYYY MM DD do we handle? */
- X/*---------------------------------------------------------------------*/
- X#define MAX_FULL_OMITS 75
- X
- X/*---------------------------------------------------------------------*/
- X/* How many global omits of the form MM DD do we handle? */
- X/*---------------------------------------------------------------------*/
- X#define MAX_PARTIAL_OMITS 75
- X
- X/*---------------------------------------------------------------------*/
- X/* The size of statically-allocated buffers for tokens. */
- X/*---------------------------------------------------------------------*/
- X#define TOKSIZE 128
- X
- X/*---------------------------------------------------------------------*/
- X/* The size of the buffer for the shell() function. */
- X/*---------------------------------------------------------------------*/
- X#define SHELLSIZE 512
- X
- X/*---------------------------------------------------------------------*/
- X/* A newline - some systems need "\n\r" */
- X/*---------------------------------------------------------------------*/
- X#define NL "\n"
- X
- X/*---------------------------------------------------------------------*/
- X/* Minimum number of linefeeds in each calendar "box" */
- X/*---------------------------------------------------------------------*/
- X#define CAL_LINES 5
- X
- X/*---------------------------------------------------------------------*/
- X/* Don't change the next definitions */
- X/*---------------------------------------------------------------------*/
- X#define PUBLIC
- X#define PRIVATE static
- SHAR_EOF
- $TOUCH -am 1109141292 config.h &&
- chmod 0600 config.h ||
- echo "restore of config.h failed"
- set `wc -c config.h`;Wc_c=$1
- if test "$Wc_c" != "7694"; then
- echo original size 7694, current size $Wc_c
- fi
- fi
- # ============= err.h ==============
- if test X"$1" != X"-c" -a -f 'err.h'; then
- echo "File already exists: skipping 'err.h'"
- else
- echo "x - extracting err.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > err.h &&
- X/***************************************************************/
- X/* */
- X/* ERR.H */
- X/* */
- X/* Error definitions. */
- X/* */
- X/* This file is part of REMIND. */
- X/* Copyright (C) 1991 by David F. Skoll. */
- X/* */
- X/***************************************************************/
- X
- X#define OK 0
- X#define E_MISS_END 1
- X#define E_MISS_QUOTE 2
- X#define E_OP_STK_OVER 3
- X#define E_VA_STK_OVER 4
- X#define E_MISS_RIGHT_PAREN 5
- X#define E_UNDEF_FUNC 6
- X#define E_ILLEGAL_CHAR 7
- X#define E_EXPECTING_BINOP 8
- X#define E_NO_MEM 9
- X#define E_BAD_NUMBER 10
- X#define E_OP_STK_UNDER 11
- X#define E_VA_STK_UNDER 12
- X#define E_CANT_COERCE 13
- X#define E_BAD_TYPE 14
- X#define E_DATE_OVER 15
- X#define E_STACK_ERR 16
- X#define E_DIV_ZERO 17
- X#define E_NOSUCH_VAR 18
- X#define E_EOLN 19
- X#define E_EOF 20
- X#define E_IO_ERR 21
- X#define E_LINE_2_LONG 22
- X#define E_SWERR 23
- X#define E_BAD_DATE 24
- X#define E_2FEW_ARGS 25
- X#define E_2MANY_ARGS 26
- X#define E_BAD_TIME 27
- X#define E_2HIGH 28
- X#define E_2LOW 29
- X#define E_CANT_OPEN 30
- X#define E_NESTED_INCLUDE 31
- X#define E_PARSE_ERR 32
- X#define E_CANT_TRIG 33
- X#define E_NESTED_IF 34
- X#define E_ELSE_NO_IF 35
- X#define E_ENDIF_NO_IF 36
- X#define E_2MANY_LOCALOMIT 37
- X#define E_EXTRANEOUS_TOKEN 38
- X#define E_POP_NO_PUSH 39
- X#define E_RUN_DISABLED 40
- X#define E_DOMAIN_ERR 41
- X#define E_BAD_ID 42
- X#define E_RECURSIVE 43
- X#define E_PARSE_AS_REM 44 /* Not really an error - just returned by
- X DoOmit to indicate line should be executed
- X as a REM statement, also. */
- X#ifdef MK_GLOBALS
- X#undef EXTERN
- X#define EXTERN
- X#else
- X#undef EXTERN
- X#define EXTERN extern
- X#endif
- X
- XEXTERN char *ErrMsg[]
- X
- X#ifdef MK_GLOBALS
- X= {
- X "Ok",
- X "Missing ']'",
- X "Missing double-quote",
- X "Expression too complex - too many operators",
- X "Expression too complex - too many operands",
- X "Missing ')'",
- X "Undefined function",
- X "Illegal character",
- X "Expecting binary operator",
- X "Out of memory",
- X "Ill-formed number",
- X "Op stack underflow - internal error",
- X "Va stack underflow - internal error",
- X "Can't coerce",
- X "Type mismatch",
- X "Date overflow",
- X "Stack error - internal error",
- X "Division by zero",
- X "Undefined variable",
- X "Unexpected end of line",
- X "Unexpected end of file",
- X "I/O error",
- X "Line too long",
- X "Internal error",
- X "Bad date specification",
- X "Not enough arguments",
- X "Too many arguments",
- X "Ill-formed time",
- X "Number too high",
- X "Number too low",
- X "Can't open file",
- X "INCLUDE nested too deeply",
- X "Parse error",
- X "Can't compute trigger",
- X "Too many nested IFs",
- X "ELSE with no matching IF",
- X "ENDIF with no matching IF",
- X "Can't OMIT every weekday",
- X "Extraneous token(s) on line",
- X "POP-OMIT-CONTEXT without matching PUSH-OMIT-CONTEXT",
- X "RUN disabled",
- X "Domain error",
- X "Invalid identifier",
- X "Recursive function call detected",
- X ""
- X}
- X#endif
- X;
- SHAR_EOF
- $TOUCH -am 1109141292 err.h &&
- chmod 0600 err.h ||
- echo "restore of err.h failed"
- set `wc -c err.h`;Wc_c=$1
- if test "$Wc_c" != "3591"; then
- echo original size 3591, current size $Wc_c
- fi
- fi
- # ============= expr.h ==============
- if test X"$1" != X"-c" -a -f 'expr.h'; then
- echo "File already exists: skipping 'expr.h'"
- else
- echo "x - extracting expr.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > expr.h &&
- X/***************************************************************/
- X/* */
- X/* EXPR.H */
- X/* */
- X/* Contains a few definitions used by expression evaluator. */
- X/* */
- X/* This file is part of REMIND. */
- X/* Copyright (C) 1991 by David F. Skoll. */
- X/* */
- X/***************************************************************/
- X
- X/* Define the types of values */
- X#define ERR_TYPE 0
- X#define INT_TYPE 1
- X#define TIM_TYPE 2
- X#define DATE_TYPE 3
- X#define STR_TYPE 4
- X
- X/* Define stuff for parsing expressions */
- X#define BEG_OF_EXPR '['
- X#define END_OF_EXPR ']'
- X#define COMMA ','
- X
- X#define UN_OP 0 /* Unary operator */
- X#define BIN_OP 1 /* Binary Operator */
- X#define FUNC 2 /* Function */
- SHAR_EOF
- $TOUCH -am 1109141292 expr.h &&
- chmod 0600 expr.h ||
- echo "restore of expr.h failed"
- set `wc -c expr.h`;Wc_c=$1
- if test "$Wc_c" != "1010"; then
- echo original size 1010, current size $Wc_c
- fi
- fi
- # ============= globals.h ==============
- if test X"$1" != X"-c" -a -f 'globals.h'; then
- echo "File already exists: skipping 'globals.h'"
- else
- echo "x - extracting globals.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > globals.h &&
- X/***************************************************************/
- X/* */
- X/* GLOBALS.H */
- X/* */
- X/* This function contains declarations of global variables. */
- X/* They are instantiated in main.c by defining */
- X/* MK_GLOBALS. Also contains useful macro definitions. */
- X/* */
- X/* This file is part of REMIND. */
- X/* Copyright (C) 1991 by David F. Skoll. */
- X/* */
- X/***************************************************************/
- X
- X#ifdef MK_GLOBALS
- X#undef EXTERN
- X#define EXTERN
- X#define INIT(var, val) var = val
- X#else
- X#undef EXTERN
- X#define EXTERN extern
- X#define INIT(var, val) var
- X#endif
- X
- X#define DaysInYear(y) (((y) % 4) ? 365 : ((!((y) % 100) && ((y) % 400)) ? 365 : 366 ))
- X#define IsLeapYear(y) (((y) % 4) ? 0 : ((!((y) % 100) && ((y) % 400)) ? 0 : 1 ))
- X#define DaysInMonth(m, y) ((m) != 1 ? MonthDays[m] : 28 + IsLeapYear(y))
- X
- XEXTERN int JulianToday;
- XEXTERN int RealToday;
- XEXTERN int CurDay;
- XEXTERN int CurMon;
- XEXTERN int CurYear;
- XEXTERN int FirstYear;
- XEXTERN int LineNo;
- XEXTERN char FreshLine;
- XEXTERN char LineBuffer[LINELEN];
- XEXTERN char SubstBuffer[LINELEN];
- XEXTERN char TokBuffer[TOKSIZE+1];
- XEXTERN INIT( char ShowAllErrors, 0);
- XEXTERN INIT( int DebugFlag, 0);
- XEXTERN INIT( char DoCalendar, 0);
- XEXTERN INIT( char DoSimpleCalendar, 0);
- XEXTERN INIT( int CalWidth, 80);
- XEXTERN INIT( int CalWeeks, 0);
- XEXTERN INIT( int CalMonths, 0);
- XEXTERN INIT( char Hush, 0);
- XEXTERN INIT( char NextMode, 0);
- XEXTERN INIT( char InfiniteDelta, 0);
- XEXTERN INIT( char RunDisabled, 0);
- XEXTERN INIT( char IgnoreOnce, 0);
- XEXTERN INIT( char Banner[LINELEN], "Reminders for %w, %d%s %m, %y%o:");
- XEXTERN char *InitialFile;
- XEXTERN int FileAccessDate;
- X
- X#ifdef HAVE_QUEUED
- XEXTERN INIT( char DontFork, 0);
- XEXTERN INIT( char DontQueue, 0);
- XEXTERN INIT( int NumQueued, 0);
- XEXTERN INIT( char DontIssueAts, 0);
- XEXTERN INIT( char Daemon, 0);
- X#endif
- X
- XEXTERN INIT( int ScFormat, SC_AMPM);
- XEXTERN INIT( int MaxSatIter, 150);
- XEXTERN INIT( char *FileName, NULL);
- XEXTERN FILE *ErrFp;
- XEXTERN INIT( int JulFirst, -1);
- XEXTERN INIT( int NumIfs, 0);
- XEXTERN INIT( unsigned int IfFlags, 0);
- XEXTERN INIT( int LastTriggerDate, 0);
- XEXTERN INIT( char LastTrigValid, 0);
- XEXTERN INIT( int LastTriggerTime, 0);
- XEXTERN INIT( char ShouldCache, 0);
- XEXTERN char *CurLine;
- XEXTERN INIT( int NumTriggered, 0);
- XEXTERN int ArgC;
- XEXTERN char **ArgV;
- X
- X/* List of months */
- XEXTERN char *MonthName[]
- X#ifdef MK_GLOBALS
- X= {"January", "February", "March", "April", "May", "June",
- X "July", "August", "September", "October", "November", "December" }
- X#endif
- X;
- X
- XEXTERN char *DayName[]
- X#ifdef MK_GLOBALS
- X= {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday",
- X "Sunday"}
- X#endif
- X;
- X
- XEXTERN int MonthDays[]
- X#ifdef MK_GLOBALS
- X= {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
- X#endif
- X;
- X
- X/* The first day of each month expressed as number of days after Jan 1.
- X Second row is for leap years. */
- X
- XEXTERN int MonthIndex[2][12]
- X#ifdef MK_GLOBALS
- X= {
- X { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 },
- X { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 }
- X }
- X#endif
- X;
- X
- SHAR_EOF
- $TOUCH -am 1109141292 globals.h &&
- chmod 0600 globals.h ||
- echo "restore of globals.h failed"
- set `wc -c globals.h`;Wc_c=$1
- if test "$Wc_c" != "3561"; then
- echo original size 3561, current size $Wc_c
- fi
- fi
- # ============= protos.h ==============
- if test X"$1" != X"-c" -a -f 'protos.h'; then
- echo "File already exists: skipping 'protos.h'"
- else
- echo "x - extracting protos.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > protos.h &&
- X/***************************************************************/
- X/* */
- X/* PROTOS.H */
- X/* */
- X/* Function Prototypes. */
- X/* */
- X/* This file is part of REMIND. */
- X/* Copyright (C) 1991 by David F. Skoll. */
- X/* */
- X/***************************************************************/
- X#ifdef HAVE_PROTOS
- X#define ARGS(x) x
- X#else
- X#define ARGS(x) ()
- X#endif
- X
- X/* Define a string assignment macro - be careful!!! */
- X#define STRSET(x, str) { if (x) free(x); (x) = StrDup(str); }
- X
- X/* Define a general malloc routine for creating pointers to objects */
- X#define NEW(type) ((type *) malloc(sizeof(type)))
- X
- X#ifdef NO_STRSTR
- Xchar *strstr ARGS ((char *s1, char *s2));
- X#endif
- X
- Xint CallUserFunc ARGS ((char *name, int nargs));
- Xint DoFset ARGS ((ParsePtr p));
- Xvoid ProduceCalendar ARGS ((void));
- Xchar *SimpleTime ARGS ((int tim, char *out));
- Xint DoRem ARGS ((ParsePtr p));
- Xint ParseRem ARGS ((ParsePtr s, Trigger *trig, TimeTrig *tim));
- Xint TriggerReminder ARGS ((ParsePtr p, Trigger *t, TimeTrig *tim, int jul));
- Xint ShouldTriggerReminder ARGS ((Trigger *t, TimeTrig *tim, int jul));
- Xint DoSubst ARGS ((ParsePtr p, char *out, Trigger *t, TimeTrig *tt, int jul, int mode));
- Xint EvalExpr ARGS ((char **e, Value *v));
- Xint PushValStack ARGS ((Value *val));
- Xint PopValStack ARGS ((Value *val));
- Xint DoCoerce ARGS ((char type, Value *v));
- Xvoid DestroyValue ARGS ((Value *v));
- Xvoid PrintValue ARGS ((Value *v, FILE *fp));
- Xint CopyValue ARGS ((Value *dest, const Value *src));
- Xint ReadLine ARGS ((void));
- Xint OpenFile ARGS ((const char *fname));
- Xint PopFile ARGS ((void));
- Xint DoInclude ARGS ((ParsePtr p));
- Xint IncludeFile ARGS ((const char *fname));
- Xint GetAccessDate ARGS ((char *file));
- Xint SetAccessDate ARGS ((char *fname, int jul));
- Xint TopLevel ARGS ((void));
- Xint CallFunc ARGS ((Operator *f, int nargs));
- Xvoid InitRemind ARGS ((int argc, char *argv[]));
- Xvoid Usage ARGS ((void));
- Xint main ARGS ((int argc, char *argv[]));
- Xint Julian ARGS ((int year, int month, int day));
- Xvoid FromJulian ARGS ((int jul, int *y, int *m, int *d));
- Xint ParseChar ARGS ((ParsePtr p, int *err, int peek));
- Xint ParseToken ARGS ((ParsePtr p, char *out));
- Xint ParseIdentifier ARGS ((ParsePtr p, char *out));
- Xint EvaluateExpr ARGS ((ParsePtr p, Value *v));
- Xint Evaluate ARGS ((char **s, Var *locals));
- Xvoid Eprint ARGS ((const char *fmt, ...));
- Xvoid OutputLine ARGS ((FILE *fp));
- Xvoid CreateParser ARGS ((char *s, ParsePtr p));
- Xvoid DestroyParser ARGS ((ParsePtr p));
- Xvoid PushToken ARGS ((const char *tok));
- Xlong SystemTime ARGS ((void));
- Xint SystemDate ARGS ((int *y, int *m, int *d));
- Xint DoIf ARGS ((ParsePtr p));
- Xint DoElse ARGS ((ParsePtr p));
- Xint DoEndif ARGS ((ParsePtr p));
- Xint DoIfTrig ARGS ((ParsePtr p));
- Xint ShouldIgnoreLine ARGS ((void));
- Xint VerifyEoln ARGS ((ParsePtr p));
- Xint DoDebug ARGS ((ParsePtr p));
- Xint DoBanner ARGS ((ParsePtr p));
- Xint DoRun ARGS ((ParsePtr p));
- Xint DoErrMsg ARGS ((ParsePtr p));
- Xint ClearGlobalOmits ARGS ((void));
- Xint DoClear ARGS ((ParsePtr p));
- Xint DestroyOmitContexts ARGS ((void));
- Xint PushOmitContext ARGS ((ParsePtr p));
- Xint PopOmitContext ARGS ((ParsePtr p));
- Xint IsOmitted ARGS ((int jul, int localomit));
- Xint DoOmit ARGS ((ParsePtr p));
- Xint QueueReminder ARGS ((ParsePtr p, int typ, TimeTrig *tim));
- Xvoid HandleQueuedReminders ARGS ((void));
- Xchar *FindInitialToken ARGS ((Token *tok, char *s));
- Xvoid FindToken ARGS ((const char *s, Token *tok));
- Xvoid FindNumericToken ARGS ((const char *s, Token *t));
- Xint ComputeTrigger ARGS ((int today, Trigger *trig, int *err));
- Xint StrEq ARGS ((const char *s1, const char *s2));
- Xint StriEq ARGS ((const char *s1, const char *s2));
- Xint StrinEq ARGS ((const char *s1, const char *s2, int n));
- Xchar *StrnCpy ARGS ((char *dest, const char *source, int n));
- Xint StrMatch ARGS ((const char *s1, const char *s2, int n));
- Xint StrinCmp ARGS ((const char *s1, const char *s2, int n));
- Xchar *StrDup ARGS ((const char *s));
- Xint StrCmpi ARGS ((char *s1, char *s2));
- XVar *FindVar ARGS ((const char *str, int create));
- Xint DeleteVar ARGS ((const char *str));
- Xint SetVar ARGS ((const char *str, Value *val));
- Xint GetVarValue ARGS ((const char *str, Value *val, Var *locals));
- Xint DoSet ARGS ((Parser *p));
- Xint DoUnset ARGS ((Parser *p));
- Xint DoDump ARGS ((ParsePtr p));
- Xvoid DumpVarTable ARGS ((void));
- Xvoid DestroyVars ARGS ((void));
- Xint PreserveVar ARGS ((char *name));
- Xint DoPreserve ARGS ((Parser *p));
- Xint DoSatRemind ARGS ((Trigger *trig, TimeTrig *tim, ParsePtr p));
- Xint ParseNonSpaceChar ARGS ((ParsePtr p, int *err, int peek));
- SHAR_EOF
- $TOUCH -am 1109141292 protos.h &&
- chmod 0600 protos.h ||
- echo "restore of protos.h failed"
- set `wc -c protos.h`;Wc_c=$1
- if test "$Wc_c" != "4850"; then
- echo original size 4850, current size $Wc_c
- fi
- fi
- # ============= types.h ==============
- if test X"$1" != X"-c" -a -f 'types.h'; then
- echo "File already exists: skipping 'types.h'"
- else
- echo "x - extracting types.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > types.h &&
- X/***************************************************************/
- X/* */
- X/* TYPES.H */
- X/* */
- X/* Type definitions all dumped here. */
- X/* */
- X/* This file is part of REMIND. */
- X/* Copyright (C) 1991 by David F. Skoll. */
- X/* */
- X/***************************************************************/
- X/* Values */
- Xtypedef struct {
- X char type;
- X union {
- X char *str;
- X int val;
- X } v;
- X} Value;
- X
- X/* Define the type of operators */
- Xtypedef struct {
- X char *name;
- X char prec;
- X char type;
- X#ifdef HAVE_PROTOS
- X int (*func)(void);
- X#else
- X int (*func) ();
- X#endif
- X} Operator;
- X
- X/* Define the structure of a variable */
- Xtypedef struct var {
- X struct var *next;
- X char name[VAR_NAME_LEN+1];
- X char preserve;
- X Value v;
- X} Var;
- X
- X/* A trigger */
- Xtypedef struct {
- X int wd;
- X int d;
- X int m;
- X int y;
- X int back;
- X int delta;
- X int rep;
- X int localomit;
- X int skip;
- X int until;
- X int typ;
- X int once;
- X} Trigger;
- X
- X/* A time trigger */
- Xtypedef struct {
- X int ttime;
- X int nexttime;
- X int delta;
- X int rep;
- X} TimeTrig;
- X
- X/* The parse pointer */
- Xtypedef struct {
- X char isnested; /* Is it a nested expression? */
- X char allownested;
- X char *text; /* Start of text */
- X char *pos; /* Current position */
- X char *etext; /* Substituted text */
- X char *epos; /* Position in substituted text */
- X} Parser;
- X
- Xtypedef Parser *ParsePtr; /* Pointer to parser structure */
- X
- X/* Some useful manifest constants */
- X#define NO_BACK 0
- X#define NO_DELTA 0
- X#define NO_REP 0
- X#define NO_WD 0
- X#define NO_DAY -1
- X#define NO_MON -1
- X#define NO_YR -1
- X#define NO_UNTIL -1
- X#define NO_ONCE 0
- X#define ONCE_ONCE 1
- X
- X#define NO_SKIP 0
- X#define SKIP_SKIP 1
- X#define BEFORE_SKIP 2
- X#define AFTER_SKIP 3
- X
- X#define NO_TIME 1500 /* >1440, ie > than the largest possible legal time */
- X
- X#define NO_TYPE 0
- X#define MSG_TYPE 1
- X#define RUN_TYPE 2
- X#define CAL_TYPE 3
- X#define SAT_TYPE 4
- X
- X/* DEFINES for debugging flags */
- X#define DB_PRTLINE 1
- X#define DB_PRTEXPR 2
- X#define DB_PRTTRIG 4
- X#define DB_DUMP_VARS 8
- X#define DB_ECHO_LINE 16
- X
- X/* Enumeration of the tokens */
- Xenum TokTypes
- X{ T_Illegal,
- X /* Commands first */
- X T_Rem, T_Push, T_Pop, T_Preserve, T_Include, T_If, T_Else, T_EndIf,
- X T_IfTrig, T_ErrMsg,
- X T_Set, T_UnSet, T_Fset, T_Omit, T_Banner, T_Exit,
- X T_WkDay,
- X T_Month, T_Time,
- X T_Skip, T_At, T_RemType, T_Until, T_Year, T_Day, T_Rep, T_Delta, T_Back,
- X T_Once,
- X T_Empty,
- X T_Comment,
- X T_Number,
- X T_Clr,
- X T_Debug,
- X T_Dumpvars
- X};
- X
- X/* The structure of a token */
- Xtypedef struct {
- X char *name;
- X char MinLen;
- X enum TokTypes type;
- X int val;
- X} Token;
- X
- X/* Flags for the state of the "if" stack */
- X#define IF_TRUE 0
- X#define IF_FALSE 1
- X#define BEFORE_ELSE 0
- X#define AFTER_ELSE 2
- X#define IF_MASK 3
- X#define IF_TRUE_MASK 1
- X#define IF_ELSE_MASK 2
- X
- X/* Flags for the DoSubst function */
- X#define NORMAL_MODE 0
- X#define CAL_MODE 1
- X#define QUOTE_MARKER 1 /* Unlikely character to appear in reminder */
- X
- X/* Flags for disabling run */
- X#define RUN_CMDLINE 1
- X#define RUN_SCRIPT 2
- X
- X/* Flags for the SimpleCalendar format */
- X#define SC_AMPM 0 /* Time shown as 3:00am, etc. */
- X#define SC_MIL 1 /* 24-hour time format */
- X#define SC_NOTIME 2 /* Do not display time in SC format. */
- SHAR_EOF
- $TOUCH -am 1109141292 types.h &&
- chmod 0600 types.h ||
- echo "restore of types.h failed"
- set `wc -c types.h`;Wc_c=$1
- if test "$Wc_c" != "3594"; then
- echo original size 3594, current size $Wc_c
- fi
- fi
- # ============= version.h ==============
- if test X"$1" != X"-c" -a -f 'version.h'; then
- echo "File already exists: skipping 'version.h'"
- else
- echo "x - extracting version.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > version.h &&
- X/***************************************************************/
- X/* */
- X/* VERSION.H */
- X/* */
- X/* What version of remind do we have? */
- X/* */
- X/* This file is part of REMIND. */
- X/* Copyright (C) 1991 by David F. Skoll. */
- X/* */
- X/***************************************************************/
- X
- X#define VERSION "03.00.00"
- SHAR_EOF
- $TOUCH -am 1109141292 version.h &&
- chmod 0600 version.h ||
- echo "restore of version.h failed"
- set `wc -c version.h`;Wc_c=$1
- if test "$Wc_c" != "688"; then
- echo original size 688, current size $Wc_c
- fi
- fi
- echo "End of part 1, continue with part 2"
- exit 0
-
- exit 0 # Just in case...
-