home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-03-07 | 56.9 KB | 1,794 lines |
- ***************
- *** 81,85 ****
- --- 93,103 ----
-
- /* Define any overrides here, such as L_ORDINAL_OVERRIDE, L_A_OVER, etc.
- See the file dosubst.c for more info. */
- + #define L_AMPM_OVERRIDE(ampm, hour) ampm = (hour < 12) ? (hour<5) ? " nachts" : " vormittags" : (hour > 17) ? " abends" : " nachmittags";
- + #define L_ORDINAL_OVERRIDE plu = ".";
- + #define L_A_OVER sprintf(s, "%s %s, den %d. %s %d", L_ON, DayName[jul%7], d, MonthName[m], y);
- + #define L_G_OVER sprintf(s, "%s %s, den %d. %s", L_ON, DayName[jul%7], d, MonthName[m]);
- + #define L_U_OVER L_A_OVER
- + #define L_V_OVER L_G_OVER
-
- #endif /* L_IN_DOSUBST */
- *** ../patch3/globals.h Thu Jan 21 16:02:55 1993
- --- ./globals.h Mon Mar 1 16:56:30 1993
- ***************
- *** 36,41 ****
- --- 36,42 ----
- EXTERN char LineBuffer[LINELEN];
- EXTERN char SubstBuffer[LINELEN];
- EXTERN char TokBuffer[TOKSIZE+1];
- + EXTERN INIT( char *MsgCommand, NULL);
- EXTERN INIT( char ShowAllErrors, 0);
- EXTERN INIT( int DebugFlag, 0);
- EXTERN INIT( char DoCalendar, 0);
- ***************
- *** 50,55 ****
- --- 51,59 ----
- EXTERN INIT( char RunDisabled, 0);
- EXTERN INIT( char IgnoreOnce, 0);
- EXTERN INIT( char Banner[LINELEN], L_BANNER);
- + EXTERN INIT( char SortByTime, 0);
- + EXTERN INIT( char SortByDate, 0);
- +
- EXTERN char *InitialFile;
- EXTERN int FileAccessDate;
-
- *** ../patch3/init.c Mon Feb 8 14:41:06 1993
- --- ./init.c Mon Mar 1 17:37:26 1993
- ***************
- *** 62,67 ****
- --- 62,68 ----
- * -bn = Time format for cal (0, 1, or 2)
- * -xn = Max. number of iterations for SATISFY
- * -uname = Run as user 'name' - only valid when run by root.
- + * -kcmd = Run 'cmd' for MSG-type reminders instead of printing to stdout
- *
- **************************************************************/
-
- ***************
- *** 156,161 ****
- --- 157,178 ----
- Hush = 1;
- break;
-
- + case 'g':
- + case 'G':
- + SortByDate = SORT_ASCEND;
- + SortByTime = SORT_ASCEND;
- + if (*arg) {
- + if (*arg == 'D' || *arg == 'd')
- + SortByDate = SORT_DESCEND;
- + arg++;
- + }
- + if (*arg) {
- + if (*arg == 'D' || *arg == 'd')
- + SortByTime = SORT_DESCEND;
- + arg++;
- + }
- + break;
- +
- #if defined(UNIX) && defined(WANT_U_OPTION)
- case 'u':
- case 'U':
- ***************
- *** 269,274 ****
- --- 286,297 ----
- if (MaxSatIter < 10) MaxSatIter=10;
- break;
-
- + case 'k':
- + case 'K':
- + MsgCommand = arg;
- + while (*arg) arg++; /* Chew up remaining chars in this arg */
- + break;
- +
- default:
- fprintf(ErrFp, "Unknown option '%c'\n", *(arg-1));
- }
- ***************
- *** 345,352 ****
- void Usage()
- #endif
- {
- ! fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992, 1993 by David F. Skoll\n\n", VERSION, L_LANGNAME);
- ! fprintf(ErrFp, " Usage: remind [options] filename [date]\n");
- fprintf(ErrFp, "Options:\n");
- fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
- fprintf(ErrFp, " -r Disable RUN directives\n");
- --- 368,375 ----
- void Usage()
- #endif
- {
- ! fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992, 1993 by David F. Skoll\n", VERSION, L_LANGNAME);
- ! fprintf(ErrFp, "Usage: remind [options] filename [date]\n");
- fprintf(ErrFp, "Options:\n");
- fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
- fprintf(ErrFp, " -r Disable RUN directives\n");
- ***************
- *** 369,374 ****
- --- 392,399 ----
- fprintf(ErrFp, " -e Divert messages normally sent to stderr to stdout\n");
- fprintf(ErrFp, " -b[n] Time format for cal: 0=am/pm, 1=24hr, 2=none\n");
- fprintf(ErrFp, " -x[n] Iteration limit for SATISFY clause (def=150)\n");
- + fprintf(ErrFp, " -kcmd Run 'cmd' for MSG-type reminders\n");
- + fprintf(ErrFp, " -g[d[d]] Sort reminders by date and time before issuing\n");
- exit(1);
- }
-
- ***************
- *** 399,405 ****
-
- static char *NoEnvMem = "Remind: Out of memory for environment\n";
- struct passwd *pwent;
- ! static char *home, *shell, *username;
-
- myuid = getuid();
- if (myuid) {
- --- 424,430 ----
-
- static char *NoEnvMem = "Remind: Out of memory for environment\n";
- struct passwd *pwent;
- ! static char *home, *shell, *username, *logname;
-
- myuid = getuid();
- if (myuid) {
- ***************
- *** 441,453 ****
- putenv(shell);
-
- if (pwent->pw_uid) {
- ! username = malloc(strlen(pwent->pw_dir) + 6);
- if (!username) {
- fprintf(ErrFp, NoEnvMem);
- exit(1);
- }
- ! sprintf(username, "USER=%s", pwent->pw_dir);
- putenv(username);
- }
- }
- #endif /* UNIX && WANT_U_OPTION */
- --- 466,485 ----
- putenv(shell);
-
- if (pwent->pw_uid) {
- ! username = malloc(strlen(pwent->pw_name) + 6);
- if (!username) {
- fprintf(ErrFp, NoEnvMem);
- exit(1);
- }
- ! sprintf(username, "USER=%s", pwent->pw_name);
- putenv(username);
- + logname= malloc(strlen(pwent->pw_name) + 9);
- + if (!logname) {
- + fprintf(ErrFp, NoEnvMem);
- + exit(1);
- + }
- + sprintf(logname, "LOGNAME=%s", pwent->pw_name);
- + putenv(logname);
- }
- }
- #endif /* UNIX && WANT_U_OPTION */
- *** ../patch3/lang.h Fri Jan 29 13:39:59 1993
- --- ./lang.h Mon Feb 15 13:45:00 1993
- ***************
- *** 11,18 ****
-
- /* I'm chauvinistic and name each language with its English name... */
-
- ! #define ENGLISH 0
- ! #define GERMAN 1
-
- /* Add more languages here - but please e-mail dfs@doe.carleton.ca
- to have your favorite language assigned a number. If you add a
- --- 11,20 ----
-
- /* I'm chauvinistic and name each language with its English name... */
-
- ! #define ENGLISH 0 /* original by David Skoll */
- ! #define GERMAN 1 /* translated by Wolfgang Thronicke */
- ! #define DUTCH 2 /* translated by Willem Kasdorp */
- ! #define FINNISH 3 /* translated by Mikko Silvonen */
-
- /* Add more languages here - but please e-mail dfs@doe.carleton.ca
- to have your favorite language assigned a number. If you add a
- ***************
- *** 27,33 ****
- --- 29,37 ----
- * Define the language you want to use here *
- * *
- ************************************************************************/
- + #ifndef LANG /* Allow for definition on compiler command line */
- #define LANG ENGLISH
- + #endif
-
- /* If LANG is not defined, it defaults to English. */
- #ifndef LANG
- ***************
- *** 40,45 ****
- --- 44,53 ----
- #include "english.h"
- #elif LANG == GERMAN
- #include "german.h"
- + #elif LANG == DUTCH
- + #include "dutch.h"
- + #elif LANG == FINNISH
- + #include "finnish.h"
-
- /* If no sensible language, choose English. I intended to use
- the #error directive here, but some C compilers barf. */
- *** ../patch3/lnk.msc Wed Dec 16 10:51:54 1992
- --- ./lnk.msc Thu Mar 4 10:44:28 1993
- ***************
- *** 8,13 ****
- --- 8,14 ----
- init.obj +
- main.obj +
- omit.obj +
- + sort.obj +
- token.obj +
- trigger.obj +
- userfns.obj +
- *** ../patch3/lnk.tc Wed Dec 16 10:51:54 1992
- --- ./lnk.tc Thu Mar 4 10:44:16 1993
- ***************
- *** 9,14 ****
- --- 9,15 ----
- init.obj
- main.obj
- omit.obj
- + sort.obj
- token.obj
- trigger.obj
- userfns.obj
- *** ../patch3/main.c Fri Feb 5 14:55:19 1993
- --- ./main.c Mon Mar 1 17:34:01 1993
- ***************
- *** 112,117 ****
- --- 112,120 ----
- if (RealToday == JulianToday) SetAccessDate(InitialFile, RealToday);
- #endif
-
- + /* If there are sorted reminders, handle them */
- + if (SortByDate) IssueSortedReminders();
- +
- /* If there are any background reminders queued up, handle them */
- #ifdef HAVE_QUEUED
- if (NumQueued || Daemon) {
- ***************
- *** 849,855 ****
- else {
- if ( (r=ParseRem(p, &trig, &tim)) ) return r;
- if (trig.typ != NO_TYPE) return E_PARSE_ERR;
- ! jul = ComputeTrigger(JulianToday, &trig, &r);
- if (r) syndrome = IF_TRUE | BEFORE_ELSE;
- else {
- if (ShouldTriggerReminder(&trig, &tim, jul))
- --- 852,858 ----
- else {
- if ( (r=ParseRem(p, &trig, &tim)) ) return r;
- if (trig.typ != NO_TYPE) return E_PARSE_ERR;
- ! jul = ComputeTrigger(trig.scanfrom, &trig, &r);
- if (r) syndrome = IF_TRUE | BEFORE_ELSE;
- else {
- if (ShouldTriggerReminder(&trig, &tim, jul))
- *** ../patch3/makefile.msc Wed Dec 16 10:51:53 1992
- --- ./makefile.msc Thu Mar 4 10:46:02 1993
- ***************
- *** 2,8 ****
-
- OBJS= calendar.obj dorem.obj dosubst.obj expr.obj files.obj funcs.obj \
- globals.obj init.obj main.obj omit.obj token.obj trigger.obj userfns.obj \
- ! utils.obj var.obj
-
- DEFINES= /D__MSDOS__ /D__MSC__
-
- --- 2,8 ----
-
- OBJS= calendar.obj dorem.obj dosubst.obj expr.obj files.obj funcs.obj \
- globals.obj init.obj main.obj omit.obj token.obj trigger.obj userfns.obj \
- ! utils.obj var.obj sort.obj
-
- DEFINES= /D__MSDOS__ /D__MSC__
-
- ***************
- *** 19,24 ****
- --- 19,27 ----
-
- expr.obj: expr.c
- cl /c $(DEFINES) $(MODEL) /Foexpr.obj expr.c
- +
- + sort.obj: sort.c
- + cl /c $(DEFINES) $(MODEL) /Fosort.obj sort.c
-
- files.obj: files.c
- cl /c $(DEFINES) $(MODEL) /Fofiles.obj files.c
- *** ../patch3/makefile.os2 Tue Feb 2 14:36:47 1993
- --- ./makefile.os2 Mon Mar 1 16:55:19 1993
- ***************
- *** 25,44 ****
- # YOU SHOULDN'T EDIT ANYTHING BELOW HERE. You may want to change some things
- # in config.h; then, you should be able to type 'make'.
- #-----------------------------------------------------------------------------
- ! VERSION= 03.00.03
-
- ! HDRS= config.h err.h expr.h globals.h protos.h types.h version.h lang.h
-
- STDHDRS= config.h types.h protos.h globals.h err.h lang.h
-
- SRCS= calendar.c dorem.c dosubst.c expr.c files.c funcs.c globals.c init.c \
- ! main.c omit.c token.c trigger.c userfns.c utils.c var.c
-
- MANIFEST= README.UNIX README.DOS COPYRIGHT $(HDRS) $(SRCS) Makefile rem rem.1 \
- remind.1 remind-all.csh remind-all.sh test.rem test-rem test.cmp makefile.tc \
- makefile.msc lnk.msc lnk.tc MANIFEST.UNX MANIFEST.DOS WHATSNEW.30 kall kall.1 \
- defs.rem README.OS2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1 \
- ! lang.h english.h german.h tstlang.rem
-
- OBJS= $(SRCS:.c=$O)
-
- --- 25,45 ----
- # YOU SHOULDN'T EDIT ANYTHING BELOW HERE. You may want to change some things
- # in config.h; then, you should be able to type 'make'.
- #-----------------------------------------------------------------------------
- ! VERSION= 03.00.04
-
- ! HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \
- ! lang.h english.h german.h dutch.h finish.h
-
- STDHDRS= config.h types.h protos.h globals.h err.h lang.h
-
- SRCS= calendar.c dorem.c dosubst.c expr.c files.c funcs.c globals.c init.c \
- ! main.c omit.c sort.c token.c trigger.c userfns.c utils.c var.c
-
- MANIFEST= README.UNIX README.DOS COPYRIGHT $(HDRS) $(SRCS) Makefile rem rem.1 \
- remind.1 remind-all.csh remind-all.sh test.rem test-rem test.cmp makefile.tc \
- makefile.msc lnk.msc lnk.tc MANIFEST.UNX MANIFEST.DOS WHATSNEW.30 kall kall.1 \
- defs.rem README.OS2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1 \
- ! tstlang.rem
-
- OBJS= $(SRCS:.c=$O)
-
- ***************
- *** 75,80 ****
- --- 76,82 ----
- init$O: init.c $(STDHDRS) expr.h version.h
- main$O: main.c $(STDHDRS) expr.h
- omit$O: omit.c $(STDHDRS)
- + sort$O: sort.c $(STDHDRS)
- token$O: token.c $(STDHDRS)
- trigger$O: trigger.c $(STDHDRS) expr.h
- userfns$O: userfns.c $(STDHDRS) expr.h
- *** ../patch3/makefile.tc Tue Feb 2 14:36:38 1993
- --- ./makefile.tc Mon Mar 1 16:55:05 1993
- ***************
- *** 1,23 ****
- # Makefile for REMIND for Turbo C for MSDOS
-
- ! VERSION= 03.00.03
-
- ! HDRS= config.h err.h expr.h globals.h protos.h types.h version.h lang.h
-
- STDHDRS= config.h types.h protos.h globals.h err.h lang.h
-
- SRCS= calendar.c dorem.c dosubst.c expr.c files.c funcs.c globals.c init.c \
- ! main.c omit.c token.c trigger.c userfns.c utils.c var.c
-
- OBJS=calendar.obj dorem.obj dosubst.obj expr.obj files.obj funcs.obj \
- ! globals.obj init.obj main.obj omit.obj token.obj trigger.obj \
- utils.obj userfns.obj var.obj
-
- MANIFEST= readme.uni readme.dos copyrigh $(HDRS) $(SRCS) makefile rem rem.1 \
- remind.1 remind-a.csh remind-a.sh test.rem test-rem test.cmp makefile.tc \
- makefile.msc lnk.msc lnk.tc manifest.dos manifest.unx whatsnew.30 kall kall.1 \
- ! defs.rem readme.os2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1 \
- ! lang.h english.h german.h tstlang.rem
-
- all: remind.exe rem2ps.exe
-
- --- 1,24 ----
- # Makefile for REMIND for Turbo C for MSDOS
-
- ! VERSION= 03.00.04
-
- ! HDRS= config.h err.h expr.h globals.h protos.h types.h version.h \
- ! lang.h english.h german.h dutch.h finnish.h
-
- STDHDRS= config.h types.h protos.h globals.h err.h lang.h
-
- SRCS= calendar.c dorem.c dosubst.c expr.c files.c funcs.c globals.c init.c \
- ! main.c omit.c sort.c token.c trigger.c userfns.c utils.c var.c
-
- OBJS=calendar.obj dorem.obj dosubst.obj expr.obj files.obj funcs.obj \
- ! globals.obj init.obj main.obj omit.obj sort.obj token.obj trigger.obj \
- utils.obj userfns.obj var.obj
-
- MANIFEST= readme.uni readme.dos copyrigh $(HDRS) $(SRCS) makefile rem rem.1 \
- remind.1 remind-a.csh remind-a.sh test.rem test-rem test.cmp makefile.tc \
- makefile.msc lnk.msc lnk.tc manifest.dos manifest.unx whatsnew.30 kall kall.1 \
- ! tstlang.rem defs.rem readme.os2 makefile.os2 rem2ps.c rem2ps.h remind.def \
- ! rem2ps.1
-
- all: remind.exe rem2ps.exe
-
- ***************
- *** 51,56 ****
- --- 52,59 ----
- main.obj: main.c $(STDHDRS) expr.h
-
- omit.obj: omit.c $(STDHDRS)
- +
- + sort.obj: sort.c $(STDHDRS)
-
- token.obj: token.c $(STDHDRS)
-
- *** ../patch3/omit.c Fri Feb 5 14:56:03 1993
- --- ./omit.c Mon Mar 1 12:59:56 1993
- ***************
- *** 33,40 ****
- static int NumFullOmits, NumPartialOmits;
-
- /* The structure for saving and restoring OMIT contexts */
- ! typedef struct _omitcontext {
- ! struct _omitcontext *next;
- int numfull, numpart;
- int *fullsave;
- int *partsave;
- --- 33,40 ----
- static int NumFullOmits, NumPartialOmits;
-
- /* The structure for saving and restoring OMIT contexts */
- ! typedef struct omitcontext {
- ! struct omitcontext *next;
- int numfull, numpart;
- int *fullsave;
- int *partsave;
- *** ../patch3/protos.h Fri Jan 8 13:24:46 1993
- --- ./protos.h Tue Mar 2 16:20:16 1993
- ***************
- *** 33,38 ****
- --- 33,39 ----
- int TriggerReminder ARGS ((ParsePtr p, Trigger *t, TimeTrig *tim, int jul));
- int ShouldTriggerReminder ARGS ((Trigger *t, TimeTrig *tim, int jul));
- int DoSubst ARGS ((ParsePtr p, char *out, Trigger *t, TimeTrig *tt, int jul, int mode));
- + int DoSubstFromString ARGS ((char *source, char *dest, int jul, int tim));
- int EvalExpr ARGS ((char **e, Value *v));
- int PushValStack ARGS ((Value *val));
- int PopValStack ARGS ((Value *val));
- ***************
- *** 111,113 ****
- --- 112,119 ----
- int DoSatRemind ARGS ((Trigger *trig, TimeTrig *tim, ParsePtr p));
- int ParseNonSpaceChar ARGS ((ParsePtr p, int *err, int peek));
- int HashVal ARGS ((const char *str));
- + int DateOK ARGS ((int y, int m, int d));
- + Operator *FindFunc ARGS ((char *name, Operator where[], int num));
- + int InsertIntoSortBuffer ARGS ((int jul, int tim, char *body, int typ));
- + void IssueSortedReminders ARGS ((void));
- + int UserFuncExists ARGS ((char *fn));
- *** ../patch3/queue.c Fri Jan 8 13:24:41 1993
- --- ./queue.c Mon Mar 1 12:58:47 1993
- ***************
- *** 28,35 ****
- #include "protos.h"
-
- /* List structure for holding queued reminders */
- ! typedef struct _queuedrem {
- ! struct _queuedrem *next;
- int typ;
- int RunDisabled;
- char *text;
- --- 28,35 ----
- #include "protos.h"
-
- /* List structure for holding queued reminders */
- ! typedef struct queuedrem {
- ! struct queuedrem *next;
- int typ;
- int RunDisabled;
- char *text;
- ***************
- *** 270,278 ****
- printf("Contents of AT queue:%s", NL);
-
- while (q) {
- ! printf("Trigger: %02d:%02d Activate: %02d:%02d Rep: %d Delta: %d%s",
- ! q->tt.ttime / 60, q->tt.ttime % 60,
- ! q->tt.nexttime / 60, q->tt.nexttime % 60,
- q->tt.rep, q->tt.delta, NL);
- printf("Text: %s %s%s%s", ((q->typ == MSG_TYPE) ? "MSG" : "RUN"),
- q->text,
- --- 270,278 ----
- printf("Contents of AT queue:%s", NL);
-
- while (q) {
- ! printf("Trigger: %02d%c%02d Activate: %02d%c%02d Rep: %d Delta: %d%s",
- ! q->tt.ttime / 60, TIMESEP, q->tt.ttime % 60,
- ! q->tt.nexttime / 60, TIMESEP, q->tt.nexttime % 60,
- q->tt.rep, q->tt.delta, NL);
- printf("Text: %s %s%s%s", ((q->typ == MSG_TYPE) ? "MSG" : "RUN"),
- q->text,
- *** ../patch3/rem2ps.1 Fri Jan 29 13:37:01 1993
- --- ./rem2ps.1 Mon Feb 15 18:45:11 1993
- ***************
- *** 24,32 ****
- not use this option, the default encoding is used.
- .TP
- .B \-m media
- ! Set the page size. You must specify the media type, which can be one of the
- ! following. (Sizes are approximate. For a list of media types, type
- ! "rem2ps -m help".)
- .RS
- .TP
- Letter
- --- 24,32 ----
- not use this option, the default encoding is used.
- .TP
- .B \-m media
- ! Set the page size. If you use the \-m option, you must specify the
- ! media type, which can be one of the
- ! following. (Sizes are approximate.)
- .RS
- .TP
- Letter
- ***************
- *** 69,75 ****
- 10 x 14 in.
- .PP
- Type "rem2ps -m help" for a list of available media. Note that the media
- ! type (and all \fBRem2ps\fR options) are case-sensitive.
- .RE
- .TP
- \fB\-f\fR[\fBshed\fR] \fIfont\fR
- --- 69,76 ----
- 10 x 14 in.
- .PP
- Type "rem2ps -m help" for a list of available media. Note that the media
- ! type (and all \fBRem2ps\fR options) are case-sensitive. If you don't use
- ! the \fB\-m\fR option, the media defaults to Letter.
- .RE
- .TP
- \fB\-f\fR[\fBshed\fR] \fIfont\fR
- *** ../patch3/rem2ps.c Mon Feb 8 14:31:59 1993
- --- ./rem2ps.c Mon Mar 1 12:59:48 1993
- ***************
- *** 31,38 ****
- #endif
- #define NEW(type) ((type *) malloc(sizeof(type)))
-
- ! typedef struct _CalEntry {
- ! struct _CalEntry *next;
- char *entry;
- } CalEntry;
-
- --- 31,38 ----
- #endif
- #define NEW(type) ((type *) malloc(sizeof(type)))
-
- ! typedef struct calentry {
- ! struct calentry *next;
- char *entry;
- } CalEntry;
-
- *** ../patch3/remind.1 Tue Feb 2 14:36:32 1993
- --- ./remind.1 Fri Mar 5 11:51:37 1993
- ***************
- *** 37,42 ****
- --- 37,43 ----
- empty boxes smaller. \fISpc\fR specifies how many blank lines to leave
- between the day number and the first reminder entry. It defaults to 1.
- .RS
- + .PP
- Any of \fIcol\fR, \fIpad\fR or \fIspc\fR can be omitted, providing you
- provide the correct number of commas. Don't use any spaces in the option.
- .RE
- ***************
- *** 106,111 ****
- --- 107,120 ----
- Echo lines when displaying error messages
- .RE
- .TP
- + \fB\-g\fR[\fBa|d\fR[\fBa|d\fR]]
- + Normally, reminders are issued in the order in which they are encountered
- + in the reminder script. The \fB\-g\fR option cause \fBRemind\fR to
- + sort reminders by date and time prior to issuing them. The optional
- + \fBa\fR and \fBd\fR characters specify the sort order (ascending or
- + descending) for the date and time fields. See the section "Sorting
- + Reminders" for more information.
- + .TP
- \fB\-b\fR[\fIn\fR]
- Set the time format for the calendar and simple-calendar outputs. \fIN\fR
- can range from 0 to 2, with the default 0. A value of 0 causes times
- ***************
- *** 117,122 ****
- --- 126,165 ----
- Sets the iteration limit for the \fBSATISFY\fR clause of a \fBREM\fR
- command. Defaults to 150.
- .TP
- + \fB\-k\fR\fIcmd\fR
- + Instead of simply printing \fBMSG\fR-type reminders, this causes them to be
- + passed to the specific \fIcmd\fR. You must use '%s' where you want the body to
- + appear, and may need to enclose this option in quotes. Also, because
- + \fIcmd\fR is run using the \fBsystem()\fR library function, shell quotes in
- + the body of the message may cause problems. Note that this option
- + \fBoverrides\fR the \fB\-r\fR option and the \fBRUN OFF\fR command.
- + .PP
- + .RS
- + As an example, suppose you have an X-Windows program called xmessage, which
- + pops up a window and displays its invocation arguments. You could use:
- + .PP
- + .nf
- + remind '-kxmessage %s &' ...
- + .fi
- + .PP
- + to have all of your \fBMSG\fR-type reminders processed using xmessage.
- + .PP
- + A word of warning: It is very easy to spawn dozens of xmessage processes
- + with the above technique. So be very careful. Also, the \fIcmd\fR is passed
- + as an argument to \fBsprintf()\fR. If you use formatting directives other
- + than %s, or use more than one %s directive, there's a good chance that
- + you'll crash \fBRemind\fR. Finally, because \fIcmd\fR is executed using
- + the \fBsystem()\fR library function, shell delimiters in \fBMSG\fR-type
- + reminders could cause problems. \fIIn particular, never run untrusted
- + reminders using the \fR\fB\-k\fR\fI option\fR. A reminder like:
- + .PP
- + .nf
- + REM msg foo ; rm -Rf .
- + .fi
- + .PP
- + would cause havoc if run with the \fB\-k\fR option.
- + .RE
- + .TP
- \fB\-z\fR[\fIn\fR]
- Runs \fBRemind\fR in the daemon mode. If \fIn\fR is supplied, it
- specifies how often (in minutes) \fBRemind\fR should wake up to
- ***************
- *** 129,135 ****
- The \fB\-u\fR option is available only to root, and cannot be used by normal
- users. The option changes the uid and gid as described, and sets the
- environment variables HOME, SHELL and USER to the home directory, shell,
- ! and user name, respectively, of the specified user. This option is meant for
- use in shell scripts which mail reminders to all users.
- .PP
- If you supply a \fIdate\fR on the command line, it must consist of
- --- 172,179 ----
- The \fB\-u\fR option is available only to root, and cannot be used by normal
- users. The option changes the uid and gid as described, and sets the
- environment variables HOME, SHELL and USER to the home directory, shell,
- ! and user name, respectively, of the specified user. LOGNAME is also
- ! set to the specified user name. This option is meant for
- use in shell scripts which mail reminders to all users.
- .PP
- If you supply a \fIdate\fR on the command line, it must consist of
- ***************
- *** 188,193 ****
- --- 232,238 ----
- [\fBOMIT\fR \fIomit_list\fR]
- [\fBAT\fR \fItime\fR [\fItdelta\fR] [\fItrepeat\fR]]
- [\fBUNTIL\fR \fIexpiry_date\fR]
- + [\fBSCANFROM\fR \fIscan_date\fR]
- \fBMSG\fR | \fBRUN\fR | \fBCAL\fR | \fBSATISFY\fR
- .I body
- .RE
- ***************
- *** 206,214 ****
- .PP
- The keywords \fBMSG\fR, \fBRUN\fR and \fBCAL\fR denote the \fItype\fR
- of the reminder. (\fBSATISFY\fR is more complicated and will be explained
- ! later.) A \fBMSG\fR type reminder simply prints a message to the standard
- output, after passing the \fIbody\fR through a special substitution filter,
- ! described in the section "The Substitution Filter." A \fBRUN\fR-type
- reminder also passes the \fIbody\fR through the substitution filter, but
- then executes the result as a system command. A \fBCAL\fR-type reminder
- is used only to place entries in the calendar produced when \fBRemind\fR
- --- 251,264 ----
- .PP
- The keywords \fBMSG\fR, \fBRUN\fR and \fBCAL\fR denote the \fItype\fR
- of the reminder. (\fBSATISFY\fR is more complicated and will be explained
- ! later.) A \fBMSG\fR-type reminder normally prints a message to the standard
- output, after passing the \fIbody\fR through a special substitution filter,
- ! described in the section "The Substitution Filter." However, if you have
- ! used the \fB\-k\fR command-line option, then \fBMSG\fR-type reminders are
- ! passed to the appropriate program. Note that the options \fB\-c\fR,
- ! \fB\-s\fR, \fB\-p\fR and \fB\-n\fR disable the \fB\-k\fR option.
- ! .PP
- ! A \fBRUN\fR-type
- reminder also passes the \fIbody\fR through the substitution filter, but
- then executes the result as a system command. A \fBCAL\fR-type reminder
- is used only to place entries in the calendar produced when \fBRemind\fR
- ***************
- *** 491,496 ****
- --- 541,553 ----
- period. Similarly, if you specify a weekday, it is used only to calculate
- the initial date, and does not affect the repetition period.
- .PP
- + .B SCANFROM
- + .PP
- + The \fBSCANFROM\fR keyword is for advanced \fBRemind\fR programmers
- + only, and will be explained in the section "Details about Trigger Computation"
- + near the end of this manual. Note that \fBSCANFROM\fR is available only
- + in versions of \fBRemind\fR from 03.00.04 up.
- + .PP
- .B EXPIRY DATES
- .PP
- Some reminders should be issued periodically for a certain time, but then
- ***************
- *** 578,583 ****
- --- 635,642 ----
- by a \fItime\fR and optional \fItdelta\fR and \fItrepeat\fR. The \fItime\fR
- must be specified in 24-hour format, with 0:00 representing midnight,
- 12:00 representing noon, and 23:59 representing one minute to midnight.
- + You can use either a colon or a period to separate the hours from the
- + minutes. That is, 13:39 and 13.39 are equivalent.
- .PP
- \fBRemind\fR treats timed reminders specially. If the trigger date
- for a timed reminder is the same as the current system date, the
- ***************
- *** 1043,1049 ****
- .PP
- If you run \fBRemind\fR with the \fB\-r\fR command-line option,
- \fBRUN\fR-type reminders and the \fBshell()\fR function will be disabled,
- ! regardless of any \fBRUN\fR commands in the reminder script.
- .PP
- One use of the \fBRUN\fR command is to provide a secure interface
- between \fBRemind\fR and the \fBElm\fR mail system. The \fBElm\fR
- --- 1102,1109 ----
- .PP
- If you run \fBRemind\fR with the \fB\-r\fR command-line option,
- \fBRUN\fR-type reminders and the \fBshell()\fR function will be disabled,
- ! regardless of any \fBRUN\fR commands in the reminder script. However,
- ! any command supplied with the \fB\-k\fR option will still be executed.
- .PP
- One use of the \fBRUN\fR command is to provide a secure interface
- between \fBRemind\fR and the \fBElm\fR mail system. The \fBElm\fR
- ***************
- *** 1071,1076 ****
- --- 1131,1139 ----
- Reminders for Friday, 30th October, 1992 (today):
- .fi
- .PP
- + (The banner is not printed if any of the calendar-producing options
- + is used, or if the \fB\-k\fR option is used.)
- + .PP
- The \fBBANNER\fR command lets you change the format. It should appear
- before any \fBREM\fR commands. The format is:
- .PP
- ***************
- *** 1166,1175 ****
- .RE
- .TP
- .B TIME constants
- ! 12:33, 0:01, 14:15, 16:42
- .PP
- .RS
- ! Note that \fBTIME\fR constants are written in 24-hour format
- .RE
- .TP
- .B DATE constants
- --- 1229,1241 ----
- .RE
- .TP
- .B TIME constants
- ! 12:33, 0:01, 14:15, 16:42, 12.16, 13.00, 1.11
- .PP
- .RS
- ! Note that \fBTIME\fR constants are written in 24-hour format. Either the
- ! period or colon can be used to separate the minutes from the hours.
- ! However, Remind will consistently output times using only one separator
- ! character. (The output separator character is chosen at compile-time.)
- .RE
- .TP
- .B DATE constants
- ***************
- *** 1389,1394 ****
- --- 1455,1468 ----
- function returns 0 if the file can be accessed with the specified \fImode\fR,
- and -1 otherwise.
- .TP
- + .B args(s_fname)
- + Returns the number of arguments expected by the user-defined function
- + \fIfname\fR, or -1 if no such user-defined function exists. Note that
- + this function examines only user-defined functions, not built-in functions.
- + Its main use is to determine whether or not a particular user-defined
- + function has been defined previously. The \fBargs()\fR function is
- + available only in versions of \fBRemind\fR from 03.00.04 and up.
- + .TP
- .B asc(s_string)
- Returns an \fBINT\fR which is the ASCII code of the first character
- in \fIstring\fR. As a special case, \fBasc("")\fR returns 0.
- ***************
- *** 1491,1496 ****
- --- 1565,1587 ----
- error if it is undefined or not of type \fBSTRING\fR.
- .RE
- .TP
- + .B dosubst(s_str [,d_date [,t_time]])
- + Returns a \fBSTRING\fR which is the result of passing \fIstr\fR through
- + the substitution filter described earlier. The parameters \fIdate\fR
- + and \fItime\fR establish the effective trigger date and time used by the
- + substitution filter. If \fIdate\fR and \fItime\fR are omitted, they
- + default to \fBtoday()\fR and \fBnow()\fR.
- + .RS
- + .PP
- + Note that if \fIstr\fR does not end with "%", a newline character will be
- + added to the end of the result. Also, calling \fBdosubst()\fR with a
- + \fIdate\fR which is in the past (i.e., if \fIdate\fR < \fBtoday()\fR)
- + will produce undefined results.
- + .PP
- + \fBDosubst()\fR is only available starting from version 03.00.04 of
- + \fBRemind\fR.
- + .RE
- + .TP
- .B filename()
- Returns (as a \fBSTRING\fR) the name of the current file being processed
- by \fBRemind\fR. Inside included files, returns the name of the
- ***************
- *** 1516,1521 ****
- --- 1607,1613 ----
- string \fIsearch\fR. The first character of a string is numbered 1.
- If \fItarget\fR does not exist in \fIsearch\fR, then 0 is returned.
- .RS
- + .PP
- The optional parameter \fIstart\fR specifies the position in
- \fIsearch\fR at which to start looking for \fItarget\fR.
- .RE
- ***************
- *** 1579,1584 ****
- --- 1671,1677 ----
- Can take from one to three arguments. If one argument is supplied, returns
- "s" if \fInum\fR is not 1, and "" if \fInum\fR is 1.
- .RS
- + .PP
- If two arguments are supplied, returns \fIstr1\fR + "s" if \fInum\fR is
- not 1. Otherwise, returns \fIstr1\fR.
- .PP
- ***************
- *** 1622,1628 ****
- calendar entry currently being computed.
- .TP
- .B trigdate()
- ! Returns the calculated trigger date of the last \fBREM\fR command. If used
- in the \fIbody\fR of a \fBREM\fR command, returns that command's trigger date.
- .TP
- .B trigger(d_date)
- --- 1715,1722 ----
- calendar entry currently being computed.
- .TP
- .B trigdate()
- ! Returns the calculated trigger date of the last \fBREM\fR
- ! or \fBIFTRIG\fR command. If used
- in the \fIbody\fR of a \fBREM\fR command, returns that command's trigger date.
- .TP
- .B trigger(d_date)
- ***************
- *** 1656,1661 ****
- --- 1750,1756 ----
- returns the value of variable XY, if it is defined. If XY is not defined,
- an error results.
- .RS
- + .PP
- However, if you supply a second argument, it is returned if the \fIvarname\fR
- is not defined. The expression value("XY", 0) will return 0 if XY is not
- defined, and the value of XY if it is defined.
- ***************
- *** 1663,1669 ****
- .TP
- .B version()
- Returns a string specifying the version of \fBRemind\fR. For version
- ! 03.00.03, returns "03.00.03". It is guaranteed that as new versions of
- \fBRemind\fR are released, the value returned by \fBversion()\fR will
- strictly increase, according to the rules for string ordering.
- .TP
- --- 1758,1764 ----
- .TP
- .B version()
- Returns a string specifying the version of \fBRemind\fR. For version
- ! 03.00.04, returns "03.00.04". It is guaranteed that as new versions of
- \fBRemind\fR are released, the value returned by \fBversion()\fR will
- strictly increase, according to the rules for string ordering.
- .TP
- ***************
- *** 1725,1730 ****
- --- 1820,1826 ----
- ["SET"] a 1
- .fi
- .RS
- + .PP
- This restriction is because \fBRemind\fR must be able to unambiguously
- determine the first token of a line for the flow-control commands (to
- be discussed later.)
- ***************
- *** 1886,1891 ****
- --- 1982,1988 ----
- The \fBvalue()\fR function \fIalways\fR accesses the "global" value of a
- variable, even if it has the same name as an argument. For example:
- .RS
- + .PP
- .nf
- fset func(x) value("x")
- set x 1
- ***************
- *** 1992,1999 ****
- for September, 1992. Labour Day was on Monday, 7 September, 1992.
- However, when \fBRemind\fR gets around to calculating the trigger
- for Tuesday, 8 September, 1992, the \fBOMIT\fR command will now be
- ! ommitting Labour Day for 1993, and the "Mon AFTER" command
- ! will not be triggered.
- .PP
- It is probably best to stay away from computing \fBOMIT\fR
- trigger dates unless you keep these pitfalls in mind.
- --- 2089,2097 ----
- for September, 1992. Labour Day was on Monday, 7 September, 1992.
- However, when \fBRemind\fR gets around to calculating the trigger
- for Tuesday, 8 September, 1992, the \fBOMIT\fR command will now be
- ! omitting Labour Day for 1993, and the "Mon AFTER" command
- ! will not be triggered. (But see the description of \fBSCANFROM\fR
- ! in the section "Details about Trigger Computation.")
- .PP
- It is probably best to stay away from computing \fBOMIT\fR
- trigger dates unless you keep these pitfalls in mind.
- ***************
- *** 2178,2183 ****
- --- 2276,2355 ----
- If you use \fBsh\fR or \fBbash\fR, you may have to use the "nohup" command
- to ensure that the daemon is not killed when you log out.
- .PP
- + .SH SORTING REMINDERS
- + .PP
- + The \fB\-g\fR option causes \fBRemind\fR to sort reminders by
- + trigger date and time before issuing them. Note that reminders are
- + still calculated in the order encountered in the script. However, rather
- + than being issued immediately, they are saved in an internal buffer.
- + When \fBRemind\fR has finished processing the script, it issues the
- + saved reminders in sorted order. The \fB\-g\fR option can be followed
- + by one or two characters, which must be "a" or "d". The first character
- + specifies the sort order by trigger date (ascending or descending) and
- + the second specifies the sort order by trigger time. The default is
- + to sort both fields in ascending order.
- + .PP
- + In ascending order, reminders are issued with the most imminent first.
- + Descending order is the reverse. Reminders are always sorted by
- + trigger date, and reminders with the same trigger date are then sorted
- + by trigger time. Non-timed reminders are always issued after timed
- + reminders in this mode.
- + .PP
- + You can define a user-defined function called SORTBANNER which takes one
- + \fBDATE\fR-type argument. In sort mode, the following sequence happens:
- + .PP
- + If \fBRemind\fR notices that the next reminder to issue has a different
- + trigger date from the previous one (or if it is the first one to be
- + issued), then SORTBANNER is called with the trigger date as its argument.
- + The result is coerced to a string, and passed through the substitution
- + filter with the appropriate trigger date. The result is then displayed.
- + .PP
- + Here's an example - consider the following fragment:
- + .PP
- + .nf
- + # Switch off the normal banner
- + BANNER %
- + REM 11 March 1993 ++1 MSG Not so important
- + REM 17 March 1993 ++7 MSG Way in the future
- + REM 10 March 1993 MSG Important Reminder
- + REM 11 March 1993 ++1 MSG Not so important - B
- + FSET sortbanner(x) iif(x == today(), \\
- + "***** THINGS TO DO TODAY *****", \\
- + "----- Things to do %b -----")
- + .fi
- + .PP
- + Running this with the \fB-gaa\fR option on 10 March 1993
- + produces the following output:
- + .PP
- + .nf
- + ***** THINGS TO DO TODAY *****
- +
- + Important Reminder
- +
- + ----- Things to do tomorrow -----
- +
- + Not so important
- +
- + Not so important - B
- +
- + ----- Things to do in 7 days' time -----
- +
- + Way in the future
- + .fi
- + .PP
- + You can use the \fBargs()\fR built-in function to determine whether or
- + not SORTBANNER has been defined. (This could be used, for example, to
- + provide a default definition for SORTBANNER in a system-wide file included
- + at the end of the user's file.) Here's an example:
- + .PP
- + .nd
- + # Create a default sortbanner function if it hasn't already
- + # been defined
- + if args("sortbanner") != 1
- + fset sortbanner(x) "--- Things to do %b ---"
- + endif
- + .fi
- + .PP
- .SH FOREIGN LANGUAGE SUPPORT
- .PP
- Your version of \fBRemind\fR may have been compiled to support a
- ***************
- *** 2197,2203 ****
- .PP
- .B COMMAND ABBREVIATIONS
- .PP
- ! The following commands can be abbreviated:
- .TP
- o
- \fBREM\fR can be omitted - it is implied if no other valid command
- --- 2369,2375 ----
- .PP
- .B COMMAND ABBREVIATIONS
- .PP
- ! The following tokens can be abbreviated:
- .TP
- o
- \fBREM\fR can be omitted - it is implied if no other valid command
- ***************
- *** 2220,2225 ****
- --- 2392,2400 ----
- .TP
- o
- \fBINCLUDE\fR --> \fBINC\fR
- + .TP
- + o
- + \fBSCANFROM\fR --> \fBSCAN\fR
- .PP
- .B NIFTY EXAMPLES
- .PP
- ***************
- *** 2283,2293 ****
- multiples of 4. The second \fBREM\fR command actually issues the
- reminder.
- .PP
- .B DETAILS ABOUT TRIGVALID()
- .PP
- The \fBtrigvalid()\fR function returns 1 if \fBRemind\fR could find a trigger
- date for the previous \fBREM\fR or \fBIFTRIG\fR command. More specifically,
- ! it returns 1 if \fBRemind\fR finds a date \fInot in the past\fR which
- satisfies the trigger. In addition, there is one special case in which
- \fBtrigvalid()\fR returns 1 and \fBtrigdate()\fR returns a meaningful result:
- .PP
- --- 2458,2532 ----
- multiples of 4. The second \fBREM\fR command actually issues the
- reminder.
- .PP
- + .B DETAILS ABOUT TRIGGER COMPUTATION
- + .PP
- + Here is a \fIconceptual\fR description of how triggers are calculated.
- + Note that \fBRemind\fR actually uses a much more efficient procedure,
- + but the results are the same as if the conceptual procedure had been
- + followed.
- + .PP
- + \fBRemind\fR starts from the current date (that is, the value of
- + \fBtoday()\fR) and scans forward, examining each day one at a time
- + until it finds a date which satisfies the trigger, or can prove that
- + no such dates (on or later than \fBtoday()\fR) exist.
- + .PP
- + If \fBRemind\fR is executing a \fBSATISFY\fR-type reminder, it evaluates
- + the expression with \fBtrigdate()\fR set to the date found above. If
- + the expression evaluates to zero or the null string, \fBRemind\fR continues
- + the scanning procedure described above, starting with the day after the
- + trigger found above.
- + .PP
- + The \fBSCANFROM\fR clause (having a syntax similar to \fBUNTIL\fR)
- + can modify the search strategy used. In this case, \fBRemind\fR begins the
- + scanning procedure at \fIscan_date\fR, which is the date specified in
- + the \fBSCANFROM\fR clause. For example:
- + .PP
- + .nf
- + REM Mon 1 SCANFROM 17 Jan 1992 MSG Foo
- + .fi
- + .PP
- + The example above will always have a trigger date of Monday, 3 February 1992.
- + That is because \fBRemind\fR starts scanning from 17 January 1992, and
- + stops scanning as soon as it hits a date which satisfies "Mon 1."
- + .PP
- + The main use of \fBSCANFROM\fR is in situations where you want to
- + calculate the positions of floating holidays. Consider the Labour
- + Day example shown much earlier. Labour Day is the first Monday
- + in September. It can move over a range of 7 days. Consider the
- + following sequence:
- + .PP
- + .nf
- + REM Mon 1 Sept SCANFROM [trigger(today()-7)] SATISFY 1
- + OMIT [trigger(trigdate())]
- +
- + REM Mon AFTER MSG Hello
- + .fi
- + .PP
- + The \fBSCANFROM\fR clause makes sure that \fBRemind\fR begins scanning
- + from 7 days before the current date. This ensures that Labour Day for
- + the current year will continue to be triggered until 7 days after it has
- + occurred. This allows you to safely use the AFTER keyword as shown.
- + .PP
- + In general, use \fBSCANFROM\fR as shown for safe moveable \fBOMITs\fR. The
- + amount you should scan back by (7 days in the example above) depends on
- + the number of possible consecutive \fBOMITted\fR days which may occur, and
- + on the range of the moveable holiday. Generally, a value of 7 is safe.
- + .PP
- + Note that if you use one \fBREM\fR command to calculate a trigger date,
- + perform date calculations (addition or subtraction, for example) and
- + then use the modified date in a subsequent \fBREM\fR command, the results
- + \fImay not be what you intended.\fR This is because you have circumvented
- + the normal scanning mechanism. You should try to write \fBREM\fR commands
- + which compute trigger dates that can be used unmodified in subsequent
- + \fBREM\fR commands. The file "defs.rem" which comes with the \fBRemind\fR
- + distribution contains examples.
- + .PP
- .B DETAILS ABOUT TRIGVALID()
- .PP
- The \fBtrigvalid()\fR function returns 1 if \fBRemind\fR could find a trigger
- date for the previous \fBREM\fR or \fBIFTRIG\fR command. More specifically,
- ! it returns 1 if \fBRemind\fR finds a date \fInot before the starting
- ! date of the scanning\fR which
- satisfies the trigger. In addition, there is one special case in which
- \fBtrigvalid()\fR returns 1 and \fBtrigdate()\fR returns a meaningful result:
- .PP
- ***************
- *** 2294,2300 ****
- If the \fBREM\fR or \fBIFTRIG\fR command did not contain an \fBUNTIL\fR
- clause, and contained all of the \fIday\fR, \fImonth\fR and \fIyear\fR
- components, then \fBRemind\fR will correctly compute a trigger date, even
- ! if it happens to be in the past. Note that this behaviour is not true for
- versions of \fBRemind\fR prior to 03.00.01.
- .SH AUTHOR
- .PP
- --- 2533,2540 ----
- If the \fBREM\fR or \fBIFTRIG\fR command did not contain an \fBUNTIL\fR
- clause, and contained all of the \fIday\fR, \fImonth\fR and \fIyear\fR
- components, then \fBRemind\fR will correctly compute a trigger date, even
- ! if it happens to be before the start of scanning.
- ! Note that this behaviour is not true for
- versions of \fBRemind\fR prior to 03.00.01.
- .SH AUTHOR
- .PP
- *** ../patch3/test.cmp Tue Feb 2 14:36:18 1993
- --- ./test.cmp Wed Mar 3 17:01:52 1993
- ***************
- *** 199,204 ****
- --- 199,226 ----
- ./test.rem(114): Trig = Monday, 18 February, 1991
-
- CLEAR-OMIT-CONTEXT
- + # Test the scanfrom clause
- + REM Fri SATISFY 1
- + ./test.rem(118): Trig = Friday, 22 February, 1991
- + OMIT [trigger(trigdate())]
- + trigdate() => 1991/02/22
- + trigger(1991/02/22) => "22 February 1991"
- + REM Fri after MSG 23 Feb 1991
- + ./test.rem(120): Trig = Saturday, 23 February, 1991
- + CLEAR-OMIT-CONTEXT
- + REM Fri SCANFROM [trigger(today()-7)] SATISFY 1
- + today() => 1991/02/16
- + 1991/02/16 - 7 => 1991/02/09
- + trigger(1991/02/09) => "9 February 1991"
- + ./test.rem(122): Trig = Friday, 15 February, 1991
- + OMIT [trigger(trigdate())]
- + trigdate() => 1991/02/15
- + trigger(1991/02/15) => "15 February 1991"
- + REM Fri after MSG 16 Feb 1991
- + ./test.rem(124): Trig = Saturday, 16 February, 1991
- + 16 Feb 1991
- +
- + CLEAR-OMIT-CONTEXT
- set a000 abs(1)
- abs(1) => 1
- set a001 abs(-1)
- ***************
- *** 221,227 ****
- coerce("string", 11:44) => "11:44"
- set a009 coerce("int", "badnews")
- coerce("int", "badnews") => Can't coerce
- ! ./test.rem(126): Can't coerce
- set a010 coerce("int", "12")
- coerce("int", "12") => 12
- set a011 coerce("int", 11:44)
- --- 243,249 ----
- coerce("string", 11:44) => "11:44"
- set a009 coerce("int", "badnews")
- coerce("int", "badnews") => Can't coerce
- ! ./test.rem(135): Can't coerce
- set a010 coerce("int", "12")
- coerce("int", "12") => 12
- set a011 coerce("int", 11:44)
- ***************
- *** 233,239 ****
- date(1992, 2, 2) => 1992/02/02
- set a014 date(1993, 2, 29)
- date(1993, 2, 29) => Bad date specification
- ! ./test.rem(131): Bad date specification
- set a015 day(today())
- today() => 1991/02/16
- day(1991/02/16) => 16
- --- 255,261 ----
- date(1992, 2, 2) => 1992/02/02
- set a014 date(1993, 2, 29)
- date(1993, 2, 29) => Bad date specification
- ! ./test.rem(140): Bad date specification
- set a015 day(today())
- today() => 1991/02/16
- day(1991/02/16) => 16
- ***************
- *** 328,342 ****
- set a050 substr(a049, 2)
- a049 => 21
- substr(21, 2) => Type mismatch
- ! ./test.rem(169): Type mismatch
- set a051 substr(a050, 2, 6)
- ! a050 => ./test.rem(170): Undefined variable: a050
- set a052 time(1+2, 3+4)
- 1 + 2 => 3
- 3 + 4 => 7
- time(3, 7) => 03:07
- rem 10 jan 1992 AT 11:22 CAL
- ! ./test.rem(172): Trig = Friday, 10 January, 1992
- set a053 trigdate()
- trigdate() => 1992/01/10
- set a054 trigtime()
- --- 350,364 ----
- set a050 substr(a049, 2)
- a049 => 21
- substr(21, 2) => Type mismatch
- ! ./test.rem(178): Type mismatch
- set a051 substr(a050, 2, 6)
- ! a050 => ./test.rem(179): Undefined variable: a050
- set a052 time(1+2, 3+4)
- 1 + 2 => 3
- 3 + 4 => 7
- time(3, 7) => 03:07
- rem 10 jan 1992 AT 11:22 CAL
- ! ./test.rem(181): Trig = Friday, 10 January, 1992
- set a053 trigdate()
- trigdate() => 1992/01/10
- set a054 trigtime()
- ***************
- *** 349,355 ****
- "a05" + "6" => "a056"
- value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
- set a058 version()
- ! version() => "03.00.03"
- set a059 wkday(today())
- today() => 1991/02/16
- wkday(1991/02/16) => "Saturday"
- --- 371,377 ----
- "a05" + "6" => "a056"
- value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
- set a058 version()
- ! version() => "03.00.04"
- set a059 wkday(today())
- today() => 1991/02/16
- wkday(1991/02/16) => "Saturday"
- ***************
- *** 389,401 ****
- fset g(x,y) max(x,y)
- fset h(x,y) min(g(x+y, x*y), g(x-y, x/y))
- set a071 g(1, 2)
- ! UserFN g(1, 2)
- x => 1
- y => 2
- max(1, 2) => 2
- Leaving UserFN g() => 2
- set a072 h(2, 3)
- ! UserFN h(2, 3)
- x => 2
- y => 3
- 2 + 3 => 5
- --- 411,423 ----
- fset g(x,y) max(x,y)
- fset h(x,y) min(g(x+y, x*y), g(x-y, x/y))
- set a071 g(1, 2)
- ! Entering UserFN g(1, 2)
- x => 1
- y => 2
- max(1, 2) => 2
- Leaving UserFN g() => 2
- set a072 h(2, 3)
- ! Entering UserFN h(2, 3)
- x => 2
- y => 3
- 2 + 3 => 5
- ***************
- *** 402,408 ****
- x => 2
- y => 3
- 2 * 3 => 6
- ! UserFN g(5, 6)
- x => 5
- y => 6
- max(5, 6) => 6
- --- 424,430 ----
- x => 2
- y => 3
- 2 * 3 => 6
- ! Entering UserFN g(5, 6)
- x => 5
- y => 6
- max(5, 6) => 6
- ***************
- *** 413,419 ****
- x => 2
- y => 3
- 2 / 3 => 0
- ! UserFN g(-1, 0)
- x => -1
- y => 0
- max(-1, 0) => 0
- --- 435,441 ----
- x => 2
- y => 3
- 2 / 3 => 0
- ! Entering UserFN g(-1, 0)
- x => -1
- y => 0
- max(-1, 0) => 0
- ***************
- *** 421,427 ****
- min(6, 0) => 0
- Leaving UserFN h() => 0
- set a073 h("foo", 11:33)
- ! UserFN h("foo", 11:33)
- x => "foo"
- y => 11:33
- "foo" + 11:33 => "foo11:33"
- --- 443,449 ----
- min(6, 0) => 0
- Leaving UserFN h() => 0
- set a073 h("foo", 11:33)
- ! Entering UserFN h("foo", 11:33)
- x => "foo"
- y => 11:33
- "foo" + 11:33 => "foo11:33"
- ***************
- *** 428,434 ****
- x => "foo"
- y => 11:33
- "foo" * 11:33 => Type mismatch
- ! ./test.rem(195): Operator '*' Type mismatch
- Leaving UserFN h() => Type mismatch
-
- Variable Value
- --- 450,456 ----
- x => "foo"
- y => 11:33
- "foo" * 11:33 => Type mismatch
- ! ./test.rem(204): Operator '*' Type mismatch
- Leaving UserFN h() => Type mismatch
-
- Variable Value
- ***************
- *** 453,459 ****
- a048 "foo"
- a067 "INT"
- a039 "February"
- ! a058 "03.00.03"
- a049 21
- a068 "STRING"
- a059 "Saturday"
- --- 475,481 ----
- a048 "foo"
- a067 "INT"
- a039 "February"
- ! a058 "03.00.04"
- a049 21
- a068 "STRING"
- a059 "Saturday"
- *** ../patch3/test.rem Wed Dec 16 10:51:50 1992
- --- ./test.rem Wed Mar 3 17:01:45 1993
- ***************
- *** 114,119 ****
- --- 114,128 ----
- REM 18 Feb 1991 ++1 MSG 18 Feb 1991 ++1 (17Feb91 omitted)
-
- CLEAR-OMIT-CONTEXT
- + # Test the scanfrom clause
- + REM Fri SATISFY 1
- + OMIT [trigger(trigdate())]
- + REM Fri after MSG 23 Feb 1991
- + CLEAR-OMIT-CONTEXT
- + REM Fri SCANFROM [trigger(today()-7)] SATISFY 1
- + OMIT [trigger(trigdate())]
- + REM Fri after MSG 16 Feb 1991
- + CLEAR-OMIT-CONTEXT
- set a000 abs(1)
- set a001 abs(-1)
- set a002 asc("foo")
- *** ../patch3/token.c Thu Jan 21 16:45:40 1993
- --- ./token.c Tue Mar 2 12:10:53 1993
- ***************
- *** 75,85 ****
- { "once", 3, T_Once, 0 },
- { "pop-omit-context", 3, T_Pop, 0 },
- { "preserve", 8, T_Preserve, 0 },
- ! { "Push-omit-context", 4, T_Push, 0 },
- { "rem", 3, T_Rem, 0 },
- { "run", 3, T_RemType, RUN_TYPE },
- { "satisfy", 7, T_RemType, SAT_TYPE },
- { "saturday", 3, T_WkDay, 5 },
- { "september", 3, T_Month, 8 },
- { "set", 3, T_Set, 0 },
- { "skip", 3, T_Skip, SKIP_SKIP },
- --- 75,86 ----
- { "once", 3, T_Once, 0 },
- { "pop-omit-context", 3, T_Pop, 0 },
- { "preserve", 8, T_Preserve, 0 },
- ! { "push-omit-context", 4, T_Push, 0 },
- { "rem", 3, T_Rem, 0 },
- { "run", 3, T_RemType, RUN_TYPE },
- { "satisfy", 7, T_RemType, SAT_TYPE },
- { "saturday", 3, T_WkDay, 5 },
- + { "scanfrom", 4, T_Scanfrom, 0 },
- { "september", 3, T_Month, 8 },
- { "set", 3, T_Set, 0 },
- { "skip", 3, T_Skip, SKIP_SKIP },
- ***************
- *** 173,178 ****
- --- 174,180 ----
- #endif
- {
- register int top, bot, mid, r;
- + int l;
-
- tok->type = T_Illegal;
- if (! *s) {
- ***************
- *** 191,196 ****
- --- 193,199 ----
- return;
- }
-
- + l = strlen(s);
- bot = 0;
- top = sizeof(TokArray) / sizeof(TokArray[0]) - 1;
-
- ***************
- *** 198,207 ****
- mid = (top + bot) / 2;
- r = TokStrCmp(&TokArray[mid], s);
- if (!r) {
- ! tok->type = TokArray[mid].type;
- ! tok->val = TokArray[mid].val;
- ! return;
- ! }
- if (r > 0) top = mid-1; else bot=mid+1;
- }
-
- --- 201,222 ----
- mid = (top + bot) / 2;
- r = TokStrCmp(&TokArray[mid], s);
- if (!r) {
- ! if (l >= TokArray[mid].MinLen) {
- ! tok->type = TokArray[mid].type;
- ! tok->val = TokArray[mid].val;
- ! return;
- ! } else {
- ! while (mid && !TokStrCmp(&TokArray[mid-1],s)) mid--;
- ! while (!TokStrCmp(&TokArray[mid], s) && l < TokArray[mid].MinLen)
- ! mid++;
- ! if (!TokStrCmp(&TokArray[mid], s)) {
- ! tok->type = TokArray[mid].type;
- ! tok->val = TokArray[mid].val;
- ! return;
- ! }
- ! }
- ! break;
- ! }
- if (r > 0) top = mid-1; else bot=mid+1;
- }
-
- ***************
- *** 209,215 ****
- array. */
- #if LANG != ENGLISH
- for (r=0; r<(sizeof(NonEnglishToks) / sizeof(Token)); r++) {
- ! if (!TokStrCmp(&NonEnglishToks[r], s)) {
- tok->type = NonEnglishToks[r].type;
- tok->val = NonEnglishToks[r].val;
- return;
- --- 224,231 ----
- array. */
- #if LANG != ENGLISH
- for (r=0; r<(sizeof(NonEnglishToks) / sizeof(Token)); r++) {
- ! if (l >= NonEnglishToks[r].MinLen &&
- ! !TokStrCmp(&NonEnglishToks[r], s)) {
- tok->type = NonEnglishToks[r].type;
- tok->val = NonEnglishToks[r].val;
- return;
- ***************
- *** 247,254 ****
- if (isdigit(*s)) {
- PARSENUM(t->val, s);
-
- ! /* If we hit a colon, we've probably got a time hr:min */
- ! if (*s == ':') {
- s++;
- hour = t->val;
- PARSENUM(min, s);
- --- 263,270 ----
- if (isdigit(*s)) {
- PARSENUM(t->val, s);
-
- ! /* If we hit a colon or a period, we've probably got a time hr:min */
- ! if (*s == ':' || *s == '.' || *s == TIMESEP) {
- s++;
- hour = t->val;
- PARSENUM(min, s);
- ***************
- *** 312,327 ****
- #endif
- {
- register int r;
- - register int l=0;
- char *tk = t->name;
- while(*tk && *s) {
- r = UPPER(*tk) - UPPER(*s);
- tk++;
- s++;
- - l++;
- if (r) return r;
- }
- - if (l < t->MinLen) return 1;
- if (!*s) return 0;
- return (*tk - *s);
- }
- --- 328,340 ----
- *** ../patch3/types.h Fri Jan 8 13:23:23 1993
- --- ./types.h Mon Mar 1 16:56:54 1993
- ***************
- *** 51,56 ****
- --- 51,57 ----
- int until;
- int typ;
- int once;
- + int scanfrom;
- } Trigger;
-
- /* A time trigger */
- ***************
- *** 84,90 ****
- #define NO_UNTIL -1
- #define NO_ONCE 0
- #define ONCE_ONCE 1
- !
- #define NO_SKIP 0
- #define SKIP_SKIP 1
- #define BEFORE_SKIP 2
- --- 85,91 ----
- #define NO_UNTIL -1
- #define NO_ONCE 0
- #define ONCE_ONCE 1
- ! #define NO_DATE -1
- #define NO_SKIP 0
- #define SKIP_SKIP 1
- #define BEFORE_SKIP 2
- ***************
- *** 121,127 ****
- T_Number,
- T_Clr,
- T_Debug,
- ! T_Dumpvars
- };
-
- /* The structure of a token */
- --- 122,129 ----
- T_Number,
- T_Clr,
- T_Debug,
- ! T_Dumpvars,
- ! T_Scanfrom
- };
-
- /* The structure of a token */
- ***************
- *** 154,156 ****
- --- 156,162 ----
- #define SC_AMPM 0 /* Time shown as 3:00am, etc. */
- #define SC_MIL 1 /* 24-hour time format */
- #define SC_NOTIME 2 /* Do not display time in SC format. */
- +
- + /* Flags for sorting */
- + #define SORT_ASCEND 1
- + #define SORT_DESCEND 2
- *** ../patch3/userfns.c Fri Feb 5 14:57:30 1993
- --- ./userfns.c Tue Mar 2 11:39:01 1993
- ***************
- *** 27,34 ****
- #define FUNC_HASH_SIZE 32 /* Size of User-defined function hash table */
-
- /* Define the data structure used to hold a user-defined function */
- ! typedef struct _udf_struct {
- ! struct _udf_struct *next;
- char name[VAR_NAME_LEN+1];
- char *text;
- Var *locals;
- --- 27,34 ----
- #define FUNC_HASH_SIZE 32 /* Size of User-defined function hash table */
-
- /* Define the data structure used to hold a user-defined function */
- ! typedef struct udf_struct {
- ! struct udf_struct *next;
- char name[VAR_NAME_LEN+1];
- char *text;
- Var *locals;
- ***************
- *** 40,45 ****
- --- 40,49 ----
- /* The hash table */
- static UserFunc *FuncHash[FUNC_HASH_SIZE];
-
- + /* Access to built-in functions */
- + extern int NumFuncs;
- + extern Operator Func[];
- +
- /* We need access to the expression evaluation stack */
- extern Value ValStack[];
- extern int ValStackPtr;
- ***************
- *** 80,85 ****
- --- 84,95 ----
- func = NEW(UserFunc);
- if (!func) return E_NO_MEM;
- StrnCpy(func->name, TokBuffer, VAR_NAME_LEN);
- + if (!Hush) {
- + if (FindFunc(TokBuffer, Func, NumFuncs)) {
- + Eprint("Warning: Attempt to redefine built-in function '%s'",
- + TokBuffer);
- + }
- + }
- func->locals = NULL;
- func->text = NULL;
- func->IsCached = 1;
- ***************
- *** 252,262 ****
- /* Search for the function */
- f = FuncHash[h];
- while (f && !StrinEq(name, f->name, VAR_NAME_LEN)) f = f->next;
- ! if (!f) return E_UNDEF_FUNC;
- !
- /* Debugging stuff */
- if (DebugFlag & DB_PRTEXPR) {
- ! fprintf(ErrFp, "UserFN %s(", f->name);
- for (i=0; i<nargs; i++) {
- PrintValue(&ValStack[ValStackPtr - nargs + i], ErrFp);
- if (i<nargs-1) fprintf(ErrFp, ", ");
- --- 262,274 ----
- /* Search for the function */
- f = FuncHash[h];
- while (f && !StrinEq(name, f->name, VAR_NAME_LEN)) f = f->next;
- ! if (!f) {
- ! Eprint("Undefined function '%s'", name);
- ! return E_UNDEF_FUNC;
- ! }
- /* Debugging stuff */
- if (DebugFlag & DB_PRTEXPR) {
- ! fprintf(ErrFp, "Entering UserFN %s(", f->name);
- for (i=0; i<nargs; i++) {
- PrintValue(&ValStack[ValStackPtr - nargs + i], ErrFp);
- if (i<nargs-1) fprintf(ErrFp, ", ");
- ***************
- *** 264,278 ****
- fprintf(ErrFp, ")\n");
- }
- /* Detect illegal recursive call */
- ! if (f->IsActive) return E_RECURSIVE;
- !
- /* Check number of args */
- ! if (nargs != f->nargs)
- return (nargs < f->nargs) ? E_2FEW_ARGS : E_2MANY_ARGS;
- !
- /* Found the function - set up a local variable frame */
- h = SetUpLocalVars(f);
- ! if (h) return h;
-
- /* Evaluate the expression */
- f->IsActive = 1;
- --- 276,307 ----
- fprintf(ErrFp, ")\n");
- }
- /* Detect illegal recursive call */
- ! if (f->IsActive) {
- ! if (DebugFlag &DB_PRTEXPR) {
- ! fprintf(ErrFp, "Leaving UserFN %s() => ", name);
- ! fprintf(ErrFp, "%s\n", ErrMsg[E_RECURSIVE]);
- ! }
- ! return E_RECURSIVE;
- ! }
- !
- /* Check number of args */
- ! if (nargs != f->nargs) {
- ! if (DebugFlag &DB_PRTEXPR) {
- ! fprintf(ErrFp, "Leaving UserFN %s() => ", name);
- ! fprintf(ErrFp, "%s\n",
- ! ErrMsg[(nargs < f->nargs) ? E_2FEW_ARGS : E_2MANY_ARGS]);
- ! }
- return (nargs < f->nargs) ? E_2FEW_ARGS : E_2MANY_ARGS;
- ! }
- /* Found the function - set up a local variable frame */
- h = SetUpLocalVars(f);
- ! if (h) {
- ! if (DebugFlag &DB_PRTEXPR) {
- ! fprintf(ErrFp, "Leaving UserFN %s() => ", name);
- ! fprintf(ErrFp, "%s\n", ErrMsg[h]);
- ! }
- ! return h;
- ! }
-
- /* Evaluate the expression */
- f->IsActive = 1;
- ***************
- *** 343,345 ****
- --- 372,398 ----
- v = v->next;
- }
- }
- + /***************************************************************/
- + /* */
- + /* UserFuncExists */
- + /* */
- + /* Return the number of arguments accepted by the function if */
- + /* it is defined, or -1 if it is not defined. */
- + /* */
- + /***************************************************************/
- + #ifdef HAVE_PROTOS
- + PUBLIC int UserFuncExists(char *fn)
- + #else
- + int UserFuncExists(fn)
- + char *fn;
- + #endif
- + {
- + UserFunc *f;
- + int h = HashVal(fn) % FUNC_HASH_SIZE;
- +
- + f = FuncHash[h];
- + while (f && !StrinEq(fn, f->name, VAR_NAME_LEN)) f = f->next;
- + if (!f) return -1;
- + else return f->nargs;
- + }
- +
- *** ../patch3/utils.c Thu Jan 21 16:33:51 1993
- --- ./utils.c Thu Feb 18 13:28:38 1993
- ***************
- *** 19,24 ****
- --- 19,25 ----
- #include <malloc.h>
- #endif
- #include <ctype.h>
- + #include "globals.h"
-
- #define UPPER(c) (islower(c) ? toupper(c) : c)
-
- ***************
- *** 218,220 ****
- --- 219,243 ----
- }
- #endif
-
- + /***************************************************************/
- + /* */
- + /* DateOK */
- + /* */
- + /* Return 1 if the date is OK, 0 otherwise. */
- + /* */
- + /***************************************************************/
- + #ifdef HAVE_PROTOS
- + PUBLIC int DateOK(int y, int m, int d)
- + #else
- + int DateOK(y, m, d)
- + int y, m, d;
- + #endif
- + {
- + if (d < 1 ||
- + m < 0 ||
- + y < BASE ||
- + m > 11 ||
- + y > BASE + YR_RANGE ||
- + d > DaysInMonth(m, y) ) return 0;
- + else return 1;
- + }
-