home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume39
/
remind
/
patch08b
/
patch.08.C
Wrap
Text File
|
1993-09-07
|
61KB
|
2,052 lines
*** ../prev/init.c Mon Jun 28 12:29:50 1993
--- ./init.c Fri Aug 20 11:46:29 1993
***************
*** 10,15 ****
--- 10,16 ----
/* Copyright (C) 1992, 1993 by David F. Skoll. */
/* */
/***************************************************************/
+ #define L_IN_INIT 1
#include "config.h"
#include <stdio.h>
#ifdef HAVE_STDLIB_H
***************
*** 29,37 ****
#include "types.h"
#include "protos.h"
#include "expr.h"
- #include "globals.h"
#include "err.h"
#include "version.h"
/***************************************************************
*
--- 30,38 ----
#include "types.h"
#include "protos.h"
#include "expr.h"
#include "err.h"
#include "version.h"
+ #include "globals.h"
/***************************************************************
*
***************
*** 65,70 ****
--- 66,72 ----
* by non-root, changes environment but not effective uid.
* -kcmd = Run 'cmd' for MSG-type reminders instead of printing to stdout
* -iVAR=EXPR = Initialize and preserve VAR.
+ * A minus sign alone indicates to take input from stdin
*
**************************************************************/
***************
*** 111,117 ****
RealToday = SystemDate(&CurYear, &CurMon, &CurDay);
if (RealToday < 0) {
! fprintf(ErrFp, "Illegal system date: Year is less than %d\n", BASE);
exit(1);
}
JulianToday = RealToday;
--- 113,119 ----
RealToday = SystemDate(&CurYear, &CurMon, &CurDay);
if (RealToday < 0) {
! fprintf(ErrFp, ErrMsg[M_BAD_SYS_DATE], BASE);
exit(1);
}
JulianToday = RealToday;
***************
*** 129,140 ****
i = 1;
while (i < argc) {
arg = argv[i];
! if (*arg != '-') break; /* Exit the loop if it's not an option */
i++;
arg++;
!
while (*arg) {
switch(*arg++) {
case 'i':
case 'I':
InitializeVar(arg);
--- 131,148 ----
i = 1;
while (i < argc) {
arg = argv[i];
! if (*arg != '-') break; /* Exit the loop if it's not an option */
i++;
arg++;
! if (!*arg) {
! UseStdin = 1;
! IgnoreOnce = 1;
! i--;
! break;
! }
while (*arg) {
switch(*arg++) {
+
case 'i':
case 'I':
InitializeVar(arg);
***************
*** 286,292 ****
case 'v': case 'V': DebugFlag |= DB_DUMP_VARS; break;
case 'l': case 'L': DebugFlag |= DB_PRTLINE; break;
default:
! fprintf(ErrFp, "Unknown debug flag '%c'\n", *(arg-1));
}
}
break;
--- 294,300 ----
case 'v': case 'V': DebugFlag |= DB_DUMP_VARS; break;
case 'l': case 'L': DebugFlag |= DB_PRTLINE; break;
default:
! fprintf(ErrFp, ErrMsg[M_BAD_DB_FLAG], *(arg-1));
}
}
break;
***************
*** 316,335 ****
break;
default:
! fprintf(ErrFp, "Unknown option '%c'\n", *(arg-1));
}
}
}
-
/* Get the filename. */
if (i >= argc) {
Usage();
exit(1);
}
! InitialFile = argv[i];
! i++;
/* Get the date, if any */
if (i < argc) {
--- 324,341 ----
break;
default:
! fprintf(ErrFp, ErrMsg[M_BAD_OPTION], *(arg-1));
}
}
}
/* Get the filename. */
if (i >= argc) {
Usage();
exit(1);
}
! InitialFile = argv[i++];
/* Get the date, if any */
if (i < argc) {
***************
*** 387,402 ****
/* Print the usage info. */
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
PUBLIC void Usage(void)
#else
void Usage()
! #endif
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992, 1993 by David F. Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
! #endif
fprintf(ErrFp, "Usage: remind [options] filename [date]\n");
fprintf(ErrFp, "Options:\n");
fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
--- 393,409 ----
/* Print the usage info. */
/* */
/***************************************************************/
+ #ifndef L_USAGE_OVERRIDE
#ifdef HAVE_PROTOS
PUBLIC void Usage(void)
#else
void Usage()
! #endif /* HAVE_PROTOS */
{
fprintf(ErrFp, "\nREMIND %s (%s version) Copyright 1992, 1993 by David F. Skoll\n", VERSION, L_LANGNAME);
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
! #endif
fprintf(ErrFp, "Usage: remind [options] filename [date]\n");
fprintf(ErrFp, "Options:\n");
fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
***************
*** 425,431 ****
fprintf(ErrFp, " -ivar=val Initialize var to val and preserve var\n");
exit(1);
}
!
/***************************************************************/
/* */
/* ChgUser */
--- 432,438 ----
fprintf(ErrFp, " -ivar=val Initialize var to val and preserve var\n");
exit(1);
}
! #endif /* L_USAGE_OVERRIDE */
/***************************************************************/
/* */
/* ChgUser */
***************
*** 451,457 ****
int myuid;
#endif
- static char *NoEnvMem = "Remind: Out of memory for environment\n";
struct passwd *pwent;
static char *home, *shell, *username, *logname;
--- 458,463 ----
***************
*** 460,482 ****
pwent = getpwnam(user);
if (!pwent) {
! fprintf(ErrFp, "Remind: Unknown user '%s'\n", user);
exit(1);
}
if (!myuid && setgid(pwent->pw_gid)) {
! fprintf(ErrFp, "Remind: Could not change gid to %d\n", pwent->pw_gid);
exit(1);
}
if (!myuid && setuid(pwent->pw_uid)) {
! fprintf(ErrFp, "Remind: Could not change uid to %d\n", pwent->pw_uid);
exit(1);
}
home = malloc(strlen(pwent->pw_dir) + 6);
if (!home) {
! fprintf(ErrFp, NoEnvMem);
exit(1);
}
sprintf(home, "HOME=%s", pwent->pw_dir);
--- 466,488 ----
pwent = getpwnam(user);
if (!pwent) {
! fprintf(ErrFp, ErrMsg[M_BAD_USER], user);
exit(1);
}
if (!myuid && setgid(pwent->pw_gid)) {
! fprintf(ErrFp, ErrMsg[M_NO_CHG_GID], pwent->pw_gid);
exit(1);
}
if (!myuid && setuid(pwent->pw_uid)) {
! fprintf(ErrFp, ErrMsg[M_NO_CHG_UID], pwent->pw_uid);
exit(1);
}
home = malloc(strlen(pwent->pw_dir) + 6);
if (!home) {
! fprintf(ErrFp, ErrMsg[M_NOMEM_ENV]);
exit(1);
}
sprintf(home, "HOME=%s", pwent->pw_dir);
***************
*** 484,490 ****
shell = malloc(strlen(pwent->pw_shell) + 7);
if (!shell) {
! fprintf(ErrFp, NoEnvMem);
exit(1);
}
sprintf(shell, "SHELL=%s", pwent->pw_shell);
--- 490,496 ----
shell = malloc(strlen(pwent->pw_shell) + 7);
if (!shell) {
! fprintf(ErrFp, ErrMsg[M_NOMEM_ENV]);
exit(1);
}
sprintf(shell, "SHELL=%s", pwent->pw_shell);
***************
*** 493,499 ****
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);
--- 499,505 ----
if (pwent->pw_uid) {
username = malloc(strlen(pwent->pw_name) + 6);
if (!username) {
! fprintf(ErrFp, ErrMsg[M_NOMEM_ENV]);
exit(1);
}
sprintf(username, "USER=%s", pwent->pw_name);
***************
*** 500,506 ****
putenv(username);
logname= malloc(strlen(pwent->pw_name) + 9);
if (!logname) {
! fprintf(ErrFp, NoEnvMem);
exit(1);
}
sprintf(logname, "LOGNAME=%s", pwent->pw_name);
--- 506,512 ----
putenv(username);
logname= malloc(strlen(pwent->pw_name) + 9);
if (!logname) {
! fprintf(ErrFp, ErrMsg[M_NOMEM_ENV]);
exit(1);
}
sprintf(logname, "LOGNAME=%s", pwent->pw_name);
***************
*** 524,530 ****
#endif
{
char *varname, *expr;
- static char Err[] = "Remind: -i option: %s\n";
Value val;
--- 530,535 ----
***************
*** 534,576 ****
varname = str;
while (*str && *str != '=') str++;
if (!*str) {
! fprintf(ErrFp, Err, "Missing '=' sign");
return;
}
*str = 0;
if (!*varname) {
! fprintf(ErrFp, Err, "Missing varname");
return;
}
expr = str+1;
if (!*expr) {
! fprintf(ErrFp, Err, "Missing expr");
return;
}
r=EvalExpr(&expr, &val);
if (r) {
! fprintf(ErrFp, Err, ErrMsg[r]);
return;
}
if (*varname == '$') {
if (val.type != INT_TYPE) {
! fprintf(ErrFp, Err, ErrMsg[E_BAD_TYPE]);
return;
}
r=SetSysVar(varname+1, val.v.val);
! if (r) fprintf(ErrFp, Err, ErrMsg[r]);
return;
}
r=SetVar(varname, &val);
if (r) {
! fprintf(ErrFp, Err, ErrMsg[r]);
return;
}
r=PreserveVar(varname);
! if (r) fprintf(ErrFp, Err, ErrMsg[r]);
return;
}
--- 539,581 ----
varname = str;
while (*str && *str != '=') str++;
if (!*str) {
! fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_MISS_EQ]);
return;
}
*str = 0;
if (!*varname) {
! fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_MISS_VAR]);
return;
}
expr = str+1;
if (!*expr) {
! fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_MISS_EXPR]);
return;
}
r=EvalExpr(&expr, &val);
if (r) {
! fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[r]);
return;
}
if (*varname == '$') {
if (val.type != INT_TYPE) {
! fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_BAD_TYPE]);
return;
}
r=SetSysVar(varname+1, val.v.val);
! if (r) fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[r]);
return;
}
r=SetVar(varname, &val);
if (r) {
! fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[r]);
return;
}
r=PreserveVar(varname);
! if (r) fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[r]);
return;
}
*** ../prev/lang.h Mon Jun 28 12:29:33 1993
--- ./lang.h Wed Aug 18 11:11:53 1993
***************
*** 13,20 ****
#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
--- 13,22 ----
#define ENGLISH 0 /* original by David Skoll */
#define GERMAN 1 /* translated by Wolfgang Thronicke */
! #define DUTCH 2 /* translated by Willem Kasdorp and Erik-Jan Vens */
#define FINNISH 3 /* translated by Mikko Silvonen */
+ #define FRENCH 4 /* translated by Laurent Duperval */
+ #define NORWEGIAN 5 /* translated by Trygve Randen */
/* Add more languages here - but please e-mail dfs@doe.carleton.ca
to have your favorite language assigned a number. If you add a
***************
*** 48,53 ****
--- 50,59 ----
#include "dutch.h"
#elif LANG == FINNISH
#include "finnish.h"
+ #elif LANG == FRENCH
+ #include "french.h"
+ #elif LANG == NORWEGIAN
+ #include "norwgian.h"
/* If no sensible language, choose English. I intended to use
the #error directive here, but some C compilers barf. */
*** ../prev/main.c Mon Jun 28 12:39:37 1993
--- ./main.c Wed Aug 25 13:06:26 1993
***************
*** 27,44 ****
#include <varargs.h>
#endif
#include <ctype.h>
#ifdef __MSDOS__
#include <dos.h>
- #include <time.h>
#endif
#ifndef __MSDOS__
#include <sys/types.h>
! #ifdef SYSV
! #include <time.h>
! #else
#include <sys/time.h>
#endif
#endif /* ifndef __MSDOS__ */
--- 27,42 ----
#include <varargs.h>
#endif
#include <ctype.h>
+ #include <time.h>
#ifdef __MSDOS__
#include <dos.h>
#endif
#ifndef __MSDOS__
#include <sys/types.h>
! #ifndef SYSV
#include <sys/time.h>
#endif
#endif /* ifndef __MSDOS__ */
***************
*** 51,56 ****
--- 49,60 ----
PRIVATE void DoReminders ARGS ((void));
+ #if defined(NEED_TIMEGM) && !defined(HAVE_MKTIME)
+ PRIVATE long time_cheat ARGS ((int year, int month));
+ long timegm ARGS((struct tm *tm));
+ long timelocal ARGS((struct tm *tm));
+ #endif
+
static char TPushBuffer[TOKSIZE+1]; /* Buffer for pushing back a token. */
static char *TokenPushed = NULL;
***************
*** 97,116 ****
if (!Hush) {
if (DestroyOmitContexts())
! Eprint("Warning: PUSH-OMIT-CONTEXT without matching POP-OMIT-CONTEXT.");
#ifdef HAVE_QUEUED
! if (!Daemon && !NextMode && !NumTriggered && !NumQueued) printf("No reminders.\n");
else
! if (!Daemon && !NextMode && !NumTriggered) printf("%d reminder%s queued for later today.\n",
! NumQueued, (NumQueued == 1) ? "" : "s");
#else
! if (!NextMode && !NumTriggered) printf("No reminders.\n");
#endif
}
/* If it's MS-DOS or OS2, reset the file access date */
#if defined(__MSDOS__) || defined(OS2)
! if (RealToday == JulianToday) SetAccessDate(InitialFile, RealToday);
#endif
/* If there are sorted reminders, handle them */
--- 101,121 ----
if (!Hush) {
if (DestroyOmitContexts())
! Eprint("%s", E_PUSH_NOPOP);
#ifdef HAVE_QUEUED
! if (!Daemon && !NextMode && !NumTriggered && !NumQueued) printf("%s\n", ErrMsg[E_NOREMINDERS]);
else
! if (!Daemon && !NextMode && !NumTriggered) printf(ErrMsg[M_QUEUED],
! NumQueued);
#else
! if (!NextMode && !NumTriggered) printf("%s\n", ErrMsg[E_NOREMINDERS]);
#endif
}
/* If it's MS-DOS or OS2, reset the file access date */
#if defined(__MSDOS__) || defined(OS2)
! if (!UseStdin && (RealToday == JulianToday))
! SetAccessDate(InitialFile, RealToday);
#endif
/* If there are sorted reminders, handle them */
***************
*** 130,136 ****
return 0;
}
if (pid == -1) {
! fprintf(ErrFp, "Couldn't fork to do queued reminders.\n");
return 1;
}
}
--- 135,141 ----
return 0;
}
if (pid == -1) {
! fprintf(ErrFp, "%s", ErrMsg[E_CANTFORK]);
return 1;
}
}
***************
*** 158,173 ****
char *s;
Parser p;
! FileAccessDate = GetAccessDate(InitialFile);
if (FileAccessDate < 0) {
! fprintf(ErrFp, "remind: Can't access file '%s'.\n", InitialFile);
exit(1);
}
r=OpenFile(InitialFile);
if (r) {
! fprintf(ErrFp, "Can't read %s: %s\n", InitialFile, ErrMsg[r]);
exit(1);
}
--- 163,180 ----
char *s;
Parser p;
! if (!UseStdin) FileAccessDate = GetAccessDate(InitialFile);
! else FileAccessDate = JulianToday;
if (FileAccessDate < 0) {
! fprintf(ErrFp, "%s: '%s'.\n", ErrMsg[E_CANTACCESS], InitialFile);
exit(1);
}
r=OpenFile(InitialFile);
if (r) {
! fprintf(ErrFp, "%s %s: %s\n", ErrMsg[E_ERR_READING],
! InitialFile, ErrMsg[r]);
exit(1);
}
***************
*** 175,181 ****
r = ReadLine();
if (r == E_EOF) return;
if (r) {
! Eprint("Error reading file: %s", ErrMsg[r]);
exit(1);
}
s = FindInitialToken(&tok, CurLine);
--- 182,188 ----
r = ReadLine();
if (r == E_EOF) return;
if (r) {
! Eprint("%s: %s", ErrMsg[E_ERR_READING], ErrMsg[r]);
exit(1);
}
s = FindInitialToken(&tok, CurLine);
***************
*** 565,571 ****
if (FreshLine) {
FreshLine = 0;
! (void) fprintf(ErrFp, "%s(%d): ", FileName, LineNo);
if (DebugFlag & DB_PRTLINE) OutputLine(ErrFp);
} else fprintf(ErrFp, " ");
--- 572,581 ----
if (FreshLine) {
FreshLine = 0;
! if (strcmp(FileName, "-"))
! (void) fprintf(ErrFp, "%s(%d): ", FileName, LineNo);
! else
! (void) fprintf(ErrFp, "-stdin-(%d): ", LineNo);
if (DebugFlag & DB_PRTLINE) OutputLine(ErrFp);
} else fprintf(ErrFp, " ");
***************
*** 911,917 ****
if ( (r = ParseToken(p, TokBuffer)) ) return r;
if (*TokBuffer && (*TokBuffer != '#') && (*TokBuffer != ';')) {
! Eprint("Expecting end-of-line, found '%s'", TokBuffer);
return E_EXTRANEOUS_TOKEN;
}
return OK;
--- 921,927 ----
if ( (r = ParseToken(p, TokBuffer)) ) return r;
if (*TokBuffer && (*TokBuffer != '#') && (*TokBuffer != ';')) {
! Eprint("%s: '%s'", ErrMsg[E_EXPECTING_EOL], TokBuffer);
return E_EXTRANEOUS_TOKEN;
}
return OK;
***************
*** 1162,1164 ****
--- 1172,1325 ----
if (isdst) *isdst = temp->tm_isdst;
return 0;
}
+
+ /***************************************************************/
+ /* */
+ /* FillParagraph */
+ /* */
+ /* Write a string to standard output, formatting it as a */
+ /* paragraph according to the FirstIndent, FormWidth and */
+ /* SubsIndent variables. Spaces are gobbled. Double-spaces */
+ /* are inserted after periods. As a special case, if the */
+ /* last char in s is '\n', an extra newline is emitted. */
+ /* */
+ /***************************************************************/
+ #ifdef HAVE_PROTOS
+ PUBLIC void FillParagraph(char *s)
+ #else
+ void FillParagraph(s)
+ char *s;
+ #endif
+ {
+
+ int line = 0;
+ int i, j;
+ int pendspace;
+ int len;
+ char *t;
+
+ int roomleft;
+
+ if (!s || !*s) return;
+
+ /* Skip leading spaces */
+ while(isspace(*s)) s++;
+
+ /* Start formatting */
+ while(1) {
+ if (!*s) {
+ if (*(s-1) == '\n') putchar('\n');
+ return;
+ }
+ /* Over here, we're at the beginning of a line. Emit the correct
+ number of spaces */
+ j = line ? SubsIndent : FirstIndent;
+ for (i=0; i<j; i++) putchar(' ');
+
+ /* Calculate the amount of room left on this line */
+ roomleft = FormWidth - j;
+ pendspace = 0;
+
+ /* Emit words until the next one won't fit */
+ while(1) {
+ while(isspace(*s)) s++;
+ t = s;
+ while(*s && !isspace(*s)) s++;
+ len = s - t;
+ if (!len) {
+ putchar('\n');
+ if (*(s-1) == '\n') putchar('\n');
+ return;
+ }
+ if (!pendspace || len+pendspace <= roomleft) {
+ for (i=0; i<pendspace; i++) putchar(' ');
+ while(t < s) {
+ putchar(*t);
+ t++;
+ }
+ } else {
+ s = t;
+ putchar('\n');
+ line++;
+ break;
+ }
+ pendspace = (*(t-1) == '.') ? 2 : 1;
+ roomleft -= len+pendspace;
+ }
+ }
+ }
+
+ #if defined(NEED_TIMEGM) && !defined(HAVE_MKTIME)
+ #define TGM_SEC (1)
+ #define TGM_MIN (60 * TGM_SEC)
+ #define TGM_HR (60 * TGM_MIN)
+ #define TGM_DAY (24 * TGM_HR)
+
+ #ifdef HAVE_PROTOS
+ PRIVATE long time_cheat(int year, int month)
+ #else
+ static long time_cheat (year, month)
+ int year;
+ int month;
+ #endif
+ {
+ long guess = time((long *) NULL);
+ struct tm g;
+ int diff;
+
+ g = *gmtime (&guess);
+ while ((diff = year - g.tm_year) > 0)
+ {
+ guess += diff * (363 - TGM_DAY);
+ g = *gmtime (&guess);
+ }
+ g.tm_mday--;
+ guess -= g.tm_sec * TGM_SEC + g.tm_min * TGM_MIN +
+ g.tm_hour * TGM_HR + g.tm_mday * TGM_DAY;
+ return (guess);
+ }
+
+ #ifdef HAVE_PROTOS
+ PUBLIC long timegm (struct tm *tm)
+ #else
+ long timegm(tm)
+ struct tm *tm;
+ #endif
+ {
+ long clock = time_cheat (tm->tm_year, tm->tm_mon);
+
+ return (clock + tm->tm_sec * TGM_SEC +
+ tm->tm_min * TGM_MIN +
+ tm->tm_hour * TGM_HR +
+ (tm->tm_mday - 1) * TGM_DAY);
+ }
+
+ #ifdef HAVE_PROTOS
+ PUBLIC long timelocal (struct tm *tm)
+ #else
+ long timelocal (tm)
+ struct tm *tm;
+ #endif
+ {
+ long zero = 0;
+ struct tm epoch;
+ int tzmin;
+ long clock;
+ struct tm test;
+
+ epoch = *localtime (&zero);
+ tzmin = epoch.tm_hour * 60 + epoch.tm_min;
+ if (tzmin > 0)
+ {
+ tzmin = 24 * 60 - tzmin;
+ if (epoch.tm_year == 70)
+ tzmin -= 24 * 60;
+ }
+ clock = timegm (tm) + tzmin * TGM_MIN;
+ test = *localtime (&clock);
+
+ if (test.tm_hour != tm->tm_hour)
+ clock -= TGM_HR;
+ return (clock);
+ }
+ #endif /* NEED_TIMEGM */
*** ../prev/makefile.os2 Mon Jun 28 12:30:19 1993
--- ./makefile.os2 Wed Aug 18 11:13:19 1993
***************
*** 25,37 ****
# 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.07
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 hbcal.c
--- 25,39 ----
# 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.08
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 french.h norwgian.h
STDHDRS= config.h types.h protos.h globals.h err.h lang.h
+ LANGHDRS= english.h german.h dutch.h finnish.h french.h norwgian.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 hbcal.c
***************
*** 68,74 ****
rem2ps$O: rem2ps.c rem2ps.h config.h
calendar$O: calendar.c $(STDHDRS) expr.h
dorem$O: dorem.c $(STDHDRS) expr.h
! dosubst$O: dosubst.c $(STDHDRS)
expr$O: expr.c $(STDHDRS) expr.h
files$O: files.c $(STDHDRS)
funcs$O: funcs.c $(STDHDRS) expr.h version.h
--- 70,76 ----
rem2ps$O: rem2ps.c rem2ps.h config.h
calendar$O: calendar.c $(STDHDRS) expr.h
dorem$O: dorem.c $(STDHDRS) expr.h
! dosubst$O: dosubst.c $(STDHDRS) $(LANGHDRS)
expr$O: expr.c $(STDHDRS) expr.h
files$O: files.c $(STDHDRS)
funcs$O: funcs.c $(STDHDRS) expr.h version.h
*** ../prev/makefile.tc Mon Jun 28 12:30:09 1993
--- ./makefile.tc Wed Aug 18 11:13:06 1993
***************
*** 1,12 ****
# Makefile for REMIND for Turbo C for MSDOS
! VERSION= 03.00.07
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 hbcal.c
--- 1,14 ----
# Makefile for REMIND for Turbo C for MSDOS
! VERSION= 03.00.08
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 french.h norwgian.h
STDHDRS= config.h types.h protos.h globals.h err.h lang.h
+ LANGHDRS= english.h german.h dutch.h finnish.h french.h norwgian.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 hbcal.c
***************
*** 37,43 ****
dorem.obj: dorem.c $(STDHDRS) expr.h
! dosubst.obj: dosubst.c $(STDHDRS)
expr.obj: expr.c $(STDHDRS) expr.h
--- 39,45 ----
dorem.obj: dorem.c $(STDHDRS) expr.h
! dosubst.obj: dosubst.c $(STDHDRS) $(LANGHDRS)
expr.obj: expr.c $(STDHDRS) expr.h
*** ../prev/omit.c Mon Jun 28 12:29:53 1993
--- ./omit.c Thu Aug 19 16:16:33 1993
***************
*** 304,329 ****
FindToken(TokBuffer, &tok);
switch (tok.type) {
case T_Year:
! if (y != NO_YR) {
! Eprint("Year specified twice");
! return E_PARSE_ERR;
! }
y = tok.val;
break;
case T_Month:
! if (m != NO_MON) {
! Eprint("Month specified twice");
! return E_PARSE_ERR;
! }
m = tok.val;
break;
case T_Day:
! if (d != NO_DAY) {
! Eprint("Day specified twice");
! return E_PARSE_ERR;
! }
d = tok.val;
break;
--- 304,320 ----
FindToken(TokBuffer, &tok);
switch (tok.type) {
case T_Year:
! if (y != NO_YR) return E_YR_TWICE;
y = tok.val;
break;
case T_Month:
! if (m != NO_MON) return E_MON_TWICE;
m = tok.val;
break;
case T_Day:
! if (d != NO_DAY) return E_DAY_TWICE;
d = tok.val;
break;
***************
*** 337,355 ****
break;
default:
! Eprint("Unknown token '%s' in OMIT command", TokBuffer);
! return E_PARSE_ERR;
}
}
! if (m == NO_MON || d == NO_DAY) {
! Eprint("Must specify month and day in OMIT command");
! return E_PARSE_ERR;
! }
if (y == NO_YR) {
! if (NumPartialOmits == MAX_PARTIAL_OMITS) {
! Eprint("Too many partial OMITs");
! return E_NO_MEM;
! }
if (d > MonthDays[m]) return E_BAD_DATE;
syndrome = (m<<5) + d;
if (!BexistsIntArray(PartialOmitArray, NumPartialOmits, syndrome)) {
--- 328,342 ----
break;
default:
! Eprint("%s: '%s' (OMIT)", ErrMsg[E_UNKNOWN_TOKEN], TokBuffer);
! return E_UNKNOWN_TOKEN;
}
}
! if (m == NO_MON || d == NO_DAY) return E_SPEC_MON_DAY;
!
if (y == NO_YR) {
! if (NumPartialOmits == MAX_PARTIAL_OMITS) return E_2MANY_PART;
!
if (d > MonthDays[m]) return E_BAD_DATE;
syndrome = (m<<5) + d;
if (!BexistsIntArray(PartialOmitArray, NumPartialOmits, syndrome)) {
***************
*** 357,366 ****
NumPartialOmits++;
}
} else {
! if (NumFullOmits == MAX_FULL_OMITS) {
! Eprint("Too many full OMITs");
! return E_NO_MEM;
! }
if (d > DaysInMonth(m, y)) return E_BAD_DATE;
syndrome = Julian(y, m, d);
if (!BexistsIntArray(FullOmitArray, NumFullOmits, syndrome)) {
--- 344,351 ----
NumPartialOmits++;
}
} else {
! if (NumFullOmits == MAX_FULL_OMITS) return E_2MANY_FULL;
!
if (d > DaysInMonth(m, y)) return E_BAD_DATE;
syndrome = Julian(y, m, d);
if (!BexistsIntArray(FullOmitArray, NumFullOmits, syndrome)) {
*** ../prev/protos.h Mon Jun 28 12:37:30 1993
--- ./protos.h Wed Aug 18 12:52:08 1993
***************
*** 108,114 ****
int DoPreserve ARGS ((Parser *p));
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));
--- 108,114 ----
int DoPreserve ARGS ((Parser *p));
int DoSatRemind ARGS ((Trigger *trig, TimeTrig *tim, ParsePtr p));
int ParseNonSpaceChar ARGS ((ParsePtr p, int *err, int peek));
! unsigned 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));
***************
*** 129,131 ****
--- 129,132 ----
int SetSysVar ARGS ((const char *name, int value));
void DumpSysVarByName ARGS ((const char *name));
int CalcMinsFromUTC ARGS ((int jul, int tim, int *mins, int *isdst));
+ void FillParagraph ARGS ((char *s));
*** ../prev/queue.c Mon Jun 28 12:29:55 1993
--- ./queue.c Thu Aug 19 16:12:20 1993
***************
*** 74,86 ****
qelem = NEW(QueuedRem);
if (!qelem) {
- Eprint("No memory to queue reminder.");
return E_NO_MEM;
}
qelem->text = StrDup(p->pos); /* Guaranteed that parser is not nested. */
if (!qelem->text) {
free(qelem);
- Eprint("No memory to queue reminder.");
return E_NO_MEM;
}
qelem->typ = typ;
--- 74,84 ----
***************
*** 275,281 ****
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,
NL, NL);
}
--- 273,280 ----
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" :
! ((q->typ == MSF_TYPE) ? "MSF" :"RUN")),
q->text,
NL, NL);
}
*** ../prev/rem2ps.1 Mon Jun 28 12:30:23 1993
--- ./rem2ps.1 Wed Jul 28 10:22:25 1993
***************
*** 29,34 ****
--- 29,43 ----
Use ISO 8859-1 standard encoding for the PostScript fonts. If you do
not use this option, the default encoding is used.
.TP
+ .B \-e
+ Make the calendar fill the entire page. By default, the calendar is
+ slightly smaller than the page. This allows days with many reminders
+ to "expand" as needed. However, if you don't have days which expand,
+ you can use this option to make all of the boxes slightly bigger.
+ One caveat: If you do use the \fB\-e\fR option and one day has many
+ reminders, the calendar may expand off the page, losing some information.
+ Experiment!
+ .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
*** ../prev/rem2ps.c Mon Jun 28 12:30:22 1993
--- ./rem2ps.c Wed Jul 28 10:15:11 1993
***************
*** 98,103 ****
--- 98,104 ----
int WkDayNum;
int LeftMarg, RightMarg, TopMarg, BotMarg;
+ int FillPage;
void Init ARGS ((int argc, char *argv[]));
void Usage ARGS ((char *s));
***************
*** 185,191 ****
printf("(%s %s) doheading\n", month, year);
/* Calculate the minimum box size */
! printf("/MinBoxSize ytop MinY sub 7 div def\n");
/* If wkday >= 2, then do the small calendars at the top. */
if (wkday >=2 && !NoSmallCal) {
--- 186,201 ----
printf("(%s %s) doheading\n", month, year);
/* Calculate the minimum box size */
! if (!FillPage) {
! printf("/MinBoxSize ytop MinY sub 7 div def\n");
! } else {
! if ((days == 31 && wkday >= 5) || (days == 30 && wkday == 6))
! printf("/MinBoxSize ytop MinY sub 6 div def\n");
! else if (days == 28 && wkday == 0 && NoSmallCal)
! printf("/MinBoxSize ytop MinY sub 4 div def\n");
! else
! printf("/MinBoxSize ytop MinY sub 5 div def\n");
! }
/* If wkday >= 2, then do the small calendars at the top. */
if (wkday >=2 && !NoSmallCal) {
***************
*** 522,527 ****
--- 532,538 ----
TopMarg = 36;
BotMarg = 36;
UseISO = 0;
+ FillPage = 0;
for(j=0; j<32; j++) PsEntries[i] = NULL;
***************
*** 618,623 ****
--- 629,636 ----
case 'c': NoSmallCal = 1; break;
+ case 'e': FillPage = 1; break;
+
default: Usage("Unrecognized option");
}
}
***************
*** 651,656 ****
--- 664,670 ----
fprintf(stderr, "-s[hed] size Set size for header, calendar entries and/or day numbers\n");
fprintf(stderr, "-b size Set border size for calendar entries\n");
fprintf(stderr, "-t size Set line thickness\n");
+ fprintf(stderr, "-e Make calendar fill entire page\n");
fprintf(stderr, "-o[lrtb] marg Specify left, right, top and bottom margins\n");
exit(1);
}
*** ../prev/remind-all.sh Mon Jun 28 12:30:06 1993
--- ./remind-all.sh Thu Aug 19 17:28:47 1993
***************
*** 1,5 ****
--- 1,10 ----
# Shell script to mail all users reminders.
+ # This file is part of REMIND
+ #
+ # REMIND is Copyright (C) 1992, 1993 by David F. Skoll
+ # This file is Copyright (C) 1990 by Bill Aten
+
# Thanks to Bill Aten for this script.
# Run it AFTER MIDNIGHT so that date is correct!
*** ../prev/remind.1 Mon Jul 19 11:31:13 1993
--- ./remind.1 Thu Aug 26 10:58:39 1993
***************
*** 9,14 ****
--- 9,18 ----
found in it. The commands are used to issue reminders and alarms. Each
reminder or alarm can consist of a message sent to standard output, or
a program to be executed.
+ .PP
+ If \fIfilename\fR is specified as a single dash '-', then \fBRemind\fR
+ takes its input from standard input. This also implicitly enables
+ the \fB\-o\fR option, described below.
.SH OPTIONS
.TP
.B \-n
***************
*** 245,251 ****
[\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 | \fBPS\fR | \fBPSFILE\fR
.I body
.RE
.PP
--- 249,256 ----
[\fBAT\fR \fItime\fR [\fItdelta\fR] [\fItrepeat\fR]]
[\fBUNTIL\fR \fIexpiry_date\fR]
[\fBSCANFROM\fR \fIscan_date\fR]
! \fBMSG\fR | \fBMSF\fR | \fBRUN\fR | \fBCAL\fR | \fBSATISFY\fR |
! \fBPS\fR | \fBPSFILE\fR
.I body
.RE
.PP
***************
*** 256,265 ****
The \fBREM\fR token is optional, providing that the remainder
of the command cannot be mistaken for another \fBRemind\fR command
such as \fBOMIT\fR or \fBRUN\fR. The portion of the \fBREM\fR command
! before the \fBMSG\fR, \fBRUN\fR, \fBCAL\fR or \fBSATISFY\fR clause
is called a \fItrigger\fR.
.PP
! .B MSG, RUN, CAL, PS and PSFILE
.PP
These keywords denote the \fItype\fR
of the reminder. (\fBSATISFY\fR is more complicated and will be explained
--- 261,270 ----
The \fBREM\fR token is optional, providing that the remainder
of the command cannot be mistaken for another \fBRemind\fR command
such as \fBOMIT\fR or \fBRUN\fR. The portion of the \fBREM\fR command
! before the \fBMSG\fR, \fBMSF\fR \fBRUN\fR, \fBCAL\fR or \fBSATISFY\fR clause
is called a \fItrigger\fR.
.PP
! .B "MSG, MSF, RUN, CAL, PS and PSFILE"
.PP
These keywords denote the \fItype\fR
of the reminder. (\fBSATISFY\fR is more complicated and will be explained
***************
*** 270,275 ****
--- 275,288 ----
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
+ The \fBMSF\fR keyword is almost the same as the \fBMSG\fR keyword,
+ except that the reminder is formatted to fit into a paragraph-like
+ format. Three system variables control the formatting of \fBMSF\fR-type
+ reminders - they are \fB$FirstIndent\fR, \fB$SubsIndent\fR and
+ \fB$FormWidth\fR. They are discussed in the section "System Variables."
+ The \fBMSF\fR keyword causes the spacing of your reminder to be altered -
+ extra spaces are discarded, and two spaces are placed after periods.
+ .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
***************
*** 1106,1111 ****
--- 1119,1126 ----
.PP
\fBINCLUDE\fR files can be nested up to a depth of 8.
.PP
+ If you specify a filename of "-" in the \fBINCLUDE\fR command, \fBRemind\fR
+ will begin reading from standard input.
.SH THE RUN COMMAND
.PP
If you include other files in your reminder script, you may not always
***************
*** 1491,1496 ****
--- 1506,1515 ----
If non-zero, then the \fB\-q\fR option was supplied on the command line.
For the MS-DOS version, always contains 1.
.TP
+ .B $FirstIndent
+ The number of spaces by which to indent the first line of a \fBMSF\fR-type
+ reminder. The default is 0.
+ .TP
.B $FoldYear
The standard Unix library functions may have difficulty dealing with dates
later than 2037. If this variable is set to 1, then the UTC calculations
***************
*** 1503,1508 ****
--- 1522,1533 ----
this variable is 0. Set it to 1 if the sun or UTC functions misbehave
for years greater than 2037.
.TP
+ .B $FormWidth
+ The maximum width of each line of text for formatting \fBMSF\fR-type
+ reminders. The default is 72. If an \fBMSF\fR-type reminder contains
+ a word too long to fit in this width, it will not be truncated - the
+ width limit will be ignored.
+ .TP
.B $HushMode (read-only)
If non-zero, then the \fB\-h\fR option was supplied on the command line.
.TP
***************
*** 1563,1568 ****
--- 1588,1599 ----
block is greater than the saved value, then at least one holiday
was triggered, and you can execute the command to shade in the
calendar box. (See the section "Calendar Mode".)
+ .PP
+ .RS
+ Note that \fB$NumTrig\fR is affected \fIonly\fR
+ by \fBREM\fR commands; triggers in \fBIFTRIG\fR commands do
+ not affect it.
+ .RE
.TP
.B $PSCal (read-only)
If non-zero, then the \fB\-p\fR option was supplied on the command line.
***************
*** 1573,1578 ****
--- 1604,1613 ----
.B $SimpleCal (read-only)
Set to a non-zero value if \fIeither\fR of the \fB\-p\fR or \fB\-s\fR
command-line options was supplied.
+ .TP
+ .B $SubsIndent
+ The number of spaces by which all lines (except the first) of an
+ \fBMSF\fR-type reminder should be indented. The default is 0.
.PP
Note: If any of the calendar modes are in effect, then the
values of $Daemon, $DontFork, $DontTrigAts, $DontQueue, $HushMode,
***************
*** 1741,1746 ****
--- 1776,1786 ----
for the specified year. If \fIarg\fR is a \fBDATE\fR, then returns the
date of the next Easter Sunday on or after \fIarg\fR.
.TP
+ .B filedate(s_filename)
+ Returns the modification date of \fIfilename\fR. If \fIfilename\fR
+ does not exist, or its modification date is before the year
+ \fBbaseyr()\fR, then 1 January of \fBbaseyr()\fR is returned.
+ .TP
.B filedir()
Returns the directory which contains the current file being
processed. It may be a relative or absolute pathname, but
***************
*** 2510,2515 ****
--- 2550,2558 ----
initialized has remained defined. Thus, time-consuming operations which
do not depend on the value of \fBtoday()\fR are done only once.
.PP
+ System variables (those whose names start with '$') are automatically
+ preserved between calendar iterations.
+ .PP
Note that for efficiency, \fBRemind\fR caches the reminder script
(and any \fBINCLUDE\fRd files) in memory when producing a calendar.
.PP
***************
*** 2723,2734 ****
.SH FOREIGN LANGUAGE SUPPORT
.PP
Your version of \fBRemind\fR may have been compiled to support a
! language other than English. This support is not complete - for
! example, all error and usage messages, as well as documentation, are
! still in English. However, foreign-language versions of \fBRemind\fR
! will output names of months and weekdays in the foreign language.
! Also, the substitution mechanism may substitute constructs suitable
! for the foreign language rather than for English.
.PP
A foreign-language version of \fBRemind\fR will accept either the English
or foreign-language names of weekdays and months in a reminder script.
--- 2766,2777 ----
.SH FOREIGN LANGUAGE SUPPORT
.PP
Your version of \fBRemind\fR may have been compiled to support a
! language other than English. This support may or may not be complete -
! for example, all error and usage messages may still be in English.
! However, at a minimum, foreign-language versions of \fBRemind\fR will
! output names of months and weekdays in the foreign language. Also,
! the substitution mechanism will substitute constructs suitable for the
! foreign language rather than for English.
.PP
A foreign-language version of \fBRemind\fR will accept either the English
or foreign-language names of weekdays and months in a reminder script.
*** ../prev/sort.c Mon Jun 28 12:29:54 1993
--- ./sort.c Thu Aug 19 16:12:01 1993
***************
*** 95,101 ****
int ShouldGoAfter;
if (!new) {
! Eprint("Out of memory for sorting.");
IssueSortedReminders();
SortByDate = 0;
SortByTime = 0;
--- 95,101 ----
int ShouldGoAfter;
if (!new) {
! Eprint("%s", ErrMsg[E_NO_MEM]);
IssueSortedReminders();
SortByDate = 0;
SortByTime = 0;
***************
*** 160,172 ****
while (cur) {
next = cur->next;
! if (cur->typ == MSG_TYPE) {
if (!MsgCommand) {
if (cur->trigdate != olddate) {
IssueSortBanner(cur->trigdate);
olddate = cur->trigdate;
}
! printf("%s\n", cur->text);
} else {
char buf[LINELEN+TOKSIZE];
sprintf(buf, MsgCommand, cur->text);
--- 160,175 ----
while (cur) {
next = cur->next;
! if (cur->typ == MSG_TYPE || cur->typ == MSF_TYPE) {
if (!MsgCommand) {
if (cur->trigdate != olddate) {
IssueSortBanner(cur->trigdate);
olddate = cur->trigdate;
}
! if (cur->typ == MSG_TYPE)
! printf("%s\n", cur->text);
! else
! FillParagraph(cur->text);
} else {
char buf[LINELEN+TOKSIZE];
sprintf(buf, MsgCommand, cur->text);
*** ../prev/test.cmp Mon Jun 28 12:30:09 1993
--- ./test.cmp Thu Aug 19 17:06:48 1993
***************
*** 187,195 ****
y => "Heshvan"
z => 1991/02/16
a => 5761
! hebdate(30, "Heshvan", 1991/02/16, 5761) => ./test.rem(33): No 30 Heshvan 5761
! Bad date specification
! Leaving UserFN _i() => Bad date specification
[_i(30, "Kislev", today(), 5759)] MSG Complete-Complete
today() => 1991/02/16
--- 187,195 ----
y => "Heshvan"
z => 1991/02/16
a => 5761
! hebdate(30, "Heshvan", 1991/02/16, 5761) => ./test.rem(33): 30 Heshvan 5761: Invalid Hebrew date
! Invalid Hebrew date
! Leaving UserFN _i() => Invalid Hebrew date
[_i(30, "Kislev", today(), 5759)] MSG Complete-Complete
today() => 1991/02/16
***************
*** 220,228 ****
y => "Kislev"
z => 1991/02/16
a => 5761
! hebdate(30, "Kislev", 1991/02/16, 5761) => ./test.rem(37): No 30 Kislev 5761
! Bad date specification
! Leaving UserFN _i() => Bad date specification
[_i(30, "Adar A", today(), 5755)] MSG Leap
today() => 1991/02/16
--- 220,228 ----
y => "Kislev"
z => 1991/02/16
a => 5761
! hebdate(30, "Kislev", 1991/02/16, 5761) => ./test.rem(37): 30 Kislev 5761: Invalid Hebrew date
! Invalid Hebrew date
! Leaving UserFN _i() => Invalid Hebrew date
[_i(30, "Adar A", today(), 5755)] MSG Leap
today() => 1991/02/16
***************
*** 243,250 ****
z => 1991/02/16
a => 5756
hebdate(30, "Adar A", 1991/02/16, 5756) => ./test.rem(40): No Adar A in 5756
! Bad date specification
! Leaving UserFN _i() => Bad date specification
[_i(29, "Adar A", today(), 5755)] MSG Leap
today() => 1991/02/16
Entering UserFN _i(29, "Adar A", 1991/02/16, 5755)
--- 243,250 ----
z => 1991/02/16
a => 5756
hebdate(30, "Adar A", 1991/02/16, 5756) => ./test.rem(40): No Adar A in 5756
! Invalid Hebrew date
! Leaving UserFN _i() => Invalid Hebrew date
[_i(29, "Adar A", today(), 5755)] MSG Leap
today() => 1991/02/16
Entering UserFN _i(29, "Adar A", 1991/02/16, 5755)
***************
*** 264,271 ****
z => 1991/02/16
a => 5756
hebdate(29, "Adar A", 1991/02/16, 5756) => ./test.rem(42): No Adar A in 5756
! Bad date specification
! Leaving UserFN _i() => Bad date specification
# Test each possible case of the basic reminders.
--- 264,271 ----
z => 1991/02/16
a => 5756
hebdate(29, "Adar A", 1991/02/16, 5756) => ./test.rem(42): No Adar A in 5756
! Invalid Hebrew date
! Leaving UserFN _i() => Invalid Hebrew date
# Test each possible case of the basic reminders.
***************
*** 631,637 ****
"a05" + "6" => "a056"
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
set a058 version()
! version() => "03.00.07"
set a059 wkday(today())
today() => 1991/02/16
wkday(1991/02/16) => "Saturday"
--- 631,637 ----
"a05" + "6" => "a056"
value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
set a058 version()
! version() => "03.00.08"
set a059 wkday(today())
today() => 1991/02/16
wkday(1991/02/16) => "Saturday"
***************
*** 710,716 ****
x => "foo"
y => 11:33
"foo" * 11:33 => Type mismatch
! ./test.rem(240): Operator '*' Type mismatch
Leaving UserFN h() => Type mismatch
set a074 dosubst("%a %b %c %d %e %f %g %h", '1992/5/5')
dosubst("%a %b %c %d %e %f %g %h", 1992/05/05) => "on Tuesday, 5 May, 1992 in 444 days' tim"...
--- 710,716 ----
x => "foo"
y => 11:33
"foo" * 11:33 => Type mismatch
! ./test.rem(240): '*': Type mismatch
Leaving UserFN h() => Type mismatch
set a074 dosubst("%a %b %c %d %e %f %g %h", '1992/5/5')
dosubst("%a %b %c %d %e %f %g %h", 1992/05/05) => "on Tuesday, 5 May, 1992 in 444 days' tim"...
***************
*** 772,778 ****
a048 "foo"
a067 "INT"
a039 "February"
! a058 "03.00.07"
a077 "1992 92
"
a049 21
--- 772,778 ----
a048 "foo"
a067 "INT"
a039 "February"
! a058 "03.00.08"
a077 "1992 92
"
a049 21
*** ../prev/token.c Mon Jun 28 12:29:56 1993
--- ./token.c Tue Aug 3 12:29:05 1993
***************
*** 68,73 ****
--- 68,74 ----
{ "march", 3, T_Month, 2 },
{ "may", 3, T_Month, 4 },
{ "monday", 3, T_WkDay, 0 },
+ { "msf", 3, T_RemType, MSF_TYPE },
{ "msg", 3, T_RemType, MSG_TYPE },
{ "november", 3, T_Month, 10 },
{ "october", 3, T_Month, 9 },
*** ../prev/trigger.c Mon Jun 28 12:29:57 1993
--- ./trigger.c Thu Aug 19 16:44:15 1993
***************
*** 246,252 ****
return j;
default:
! Eprint("NextSimpleTrig: Bad type %d", typ);
*err = E_SWERR;
return -1;
}
--- 246,252 ----
return j;
default:
! Eprint("NextSimpleTrig %s %d", ErrMsg[E_SWERR], typ);
*err = E_SWERR;
return -1;
}
***************
*** 395,402 ****
(trig->d == NO_DAY ||
trig->m == NO_MON ||
trig->y == NO_YR)) {
! Eprint("Must fully specify date to use repeat.");
! *err = E_PARSE_ERR;
return -1;
}
--- 395,402 ----
(trig->d == NO_DAY ||
trig->m == NO_MON ||
trig->y == NO_YR)) {
! Eprint("%s", ErrMsg[E_REP_FULSPEC]);
! *err = E_REP_FULSPEC;
return -1;
}
***************
*** 408,415 ****
if (*err) return -1;
if (result == -1) {
if (DebugFlag & DB_PRTTRIG) {
! fprintf(ErrFp, "%s(%d): Expired\n",
! FileName, LineNo);
}
return -1;
}
--- 408,415 ----
if (*err) return -1;
if (result == -1) {
if (DebugFlag & DB_PRTTRIG) {
! fprintf(ErrFp, "%s(%d): %s\n",
! FileName, LineNo, ErrMsg[E_EXPIRED]);
}
return -1;
}
***************
*** 436,443 ****
trig->skip == NO_SKIP &&
trig->rep == NO_REP) {
if (DebugFlag & DB_PRTTRIG) {
! fprintf(ErrFp, "%s(%d): Expired\n",
! FileName, LineNo);
}
if (result != -1) {
LastTriggerDate = result;
--- 436,443 ----
trig->skip == NO_SKIP &&
trig->rep == NO_REP) {
if (DebugFlag & DB_PRTTRIG) {
! fprintf(ErrFp, "%s(%d): %s\n",
! FileName, LineNo, ErrMsg[E_EXPIRED]);
}
if (result != -1) {
LastTriggerDate = result;
***************
*** 452,459 ****
LastTrigValid = 1;
}
if (DebugFlag & DB_PRTTRIG) {
! fprintf(ErrFp, "%s(%d): Expired\n",
! FileName, LineNo);
}
return -1;
}
--- 452,459 ----
LastTrigValid = 1;
}
if (DebugFlag & DB_PRTTRIG) {
! fprintf(ErrFp, "%s(%d): %s\n",
! FileName, LineNo, ErrMsg[E_EXPIRED]);
}
return -1;
}
*** ../prev/tstlang.rem Mon Jun 28 12:30:24 1993
--- ./tstlang.rem Thu Aug 19 16:01:52 1993
***************
*** 15,23 ****
#
# ---------------------------------------------------------------------------
! if version()<"03.00.02"
errmsg %
! errmsg This file only works with Remind version 03.00.02 and later - aborting
exit
endif
--- 15,30 ----
#
# ---------------------------------------------------------------------------
! if version()<"03.00.08"
errmsg %
! errmsg This file only works with Remind version 03.00.08 and later - aborting
! exit
! endif
!
! if !$RunOff || !$DontQueue || $DontTrigAts
! errmsg %
! errmsg Please run [filename()] with the -q and -r options, but%
! errmsg not the -a option.
exit
endif
*** ../prev/types.h Mon Jun 28 12:29:32 1993
--- ./types.h Tue Aug 3 12:28:45 1993
***************
*** 100,105 ****
--- 100,106 ----
#define SAT_TYPE 4
#define PS_TYPE 5
#define PSF_TYPE 6
+ #define MSF_TYPE 7
/* DEFINES for debugging flags */
#define DB_PRTLINE 1
*** ../prev/userfns.c Mon Jun 28 12:38:47 1993
--- ./userfns.c Thu Aug 19 16:43:05 1993
***************
*** 87,93 ****
StrnCpy(func->name, TokBuffer, VAR_NAME_LEN);
if (!Hush) {
if (FindFunc(TokBuffer, Func, NumFuncs)) {
! Eprint("Warning: Attempt to redefine built-in function '%s'",
TokBuffer);
}
}
--- 87,93 ----
StrnCpy(func->name, TokBuffer, VAR_NAME_LEN);
if (!Hush) {
if (FindFunc(TokBuffer, Func, NumFuncs)) {
! Eprint("%s: '%s'", ErrMsg[E_REDEF_FUNC],
TokBuffer);
}
}
***************
*** 131,137 ****
/* Copy the text over */
if (p->isnested) {
! Eprint ("Can't nest function definition in expression.");
DestroyUserFunc(func);
return E_PARSE_ERR;
}
--- 131,137 ----
/* Copy the text over */
if (p->isnested) {
! Eprint("%s", ErrMsg[E_CANTNEST_FDEF]);
DestroyUserFunc(func);
return E_PARSE_ERR;
}
***************
*** 265,276 ****
f = FuncHash[h];
while (f && StrinCmp(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, ", ");
--- 265,276 ----
f = FuncHash[h];
while (f && StrinCmp(name, f->name, VAR_NAME_LEN)) f = f->next;
if (!f) {
! Eprint("%s: '%s'", ErrMsg[E_UNDEF_FUNC], name);
return E_UNDEF_FUNC;
}
/* Debugging stuff */
if (DebugFlag & DB_PRTEXPR) {
! fprintf(ErrFp, "%s %s(", ErrMsg[E_ENTER_FUN], f->name);
for (i=0; i<nargs; i++) {
PrintValue(&ValStack[ValStackPtr - nargs + i], ErrFp);
if (i<nargs-1) fprintf(ErrFp, ", ");
***************
*** 280,286 ****
/* 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;
--- 280,286 ----
/* Detect illegal recursive call */
if (f->IsActive) {
if (DebugFlag &DB_PRTEXPR) {
! fprintf(ErrFp, "%s %s() => ", ErrMsg[E_LEAVE_FUN], name);
fprintf(ErrFp, "%s\n", ErrMsg[E_RECURSIVE]);
}
return E_RECURSIVE;
***************
*** 289,295 ****
/* 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]);
}
--- 289,295 ----
/* Check number of args */
if (nargs != f->nargs) {
if (DebugFlag &DB_PRTEXPR) {
! fprintf(ErrFp, "%s %s() => ", ErrMsg[E_LEAVE_FUN], name);
fprintf(ErrFp, "%s\n",
ErrMsg[(nargs < f->nargs) ? E_2FEW_ARGS : E_2MANY_ARGS]);
}
***************
*** 299,305 ****
h = SetUpLocalVars(f);
if (h) {
if (DebugFlag &DB_PRTEXPR) {
! fprintf(ErrFp, "Leaving UserFN %s() => ", name);
fprintf(ErrFp, "%s\n", ErrMsg[h]);
}
return h;
--- 299,305 ----
h = SetUpLocalVars(f);
if (h) {
if (DebugFlag &DB_PRTEXPR) {
! fprintf(ErrFp, "%s %s() => ", ErrMsg[E_LEAVE_FUN], name);
fprintf(ErrFp, "%s\n", ErrMsg[h]);
}
return h;
***************
*** 316,322 ****
f->IsActive = 0;
DestroyLocalVals(f);
if (DebugFlag &DB_PRTEXPR) {
! fprintf(ErrFp, "Leaving UserFN %s() => ", name);
if (h) fprintf(ErrFp, "%s\n", ErrMsg[h]);
else {
PrintValue(&ValStack[ValStackPtr-1], ErrFp);
--- 316,322 ----
f->IsActive = 0;
DestroyLocalVals(f);
if (DebugFlag &DB_PRTEXPR) {
! fprintf(ErrFp, "%s %s() => ", ErrMsg[E_LEAVE_FUN], name);
if (h) fprintf(ErrFp, "%s\n", ErrMsg[h]);
else {
PrintValue(&ValStack[ValStackPtr-1], ErrFp);
*** ../prev/utils.c Mon Jun 28 12:37:05 1993
--- ./utils.c Wed Aug 25 14:49:21 1993
***************
*** 19,25 ****
--- 19,27 ----
#include <malloc.h>
#endif
#include <ctype.h>
+ #include "types.h"
#include "globals.h"
+ #include "protos.h"
#define UPPER(c) (islower(c) ? toupper(c) : c)
*** ../prev/var.c Mon Jul 19 10:58:54 1993
--- ./var.c Thu Aug 19 16:40:40 1993
***************
*** 29,34 ****
--- 29,38 ----
/* The variable hash table */
#define VAR_HASH_SIZE 64
+ #define VARIABLE ErrMsg[E_VAR]
+ #define VALUE ErrMsg[E_VAL]
+ #define UNDEF ErrMsg[E_UNDEF]
+
static Var *VHashTbl[VAR_HASH_SIZE];
/***************************************************************/
***************
*** 38,55 ****
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
! PUBLIC int HashVal(const char *str)
#else
! int HashVal(str)
char *str;
#endif
{
! register int i = 0;
! register int j=1;
! register int len=0;
while(*str && len < VAR_NAME_LEN) {
! i += j * UPPER(*str);
str++;
len++;
j = 3-j;
--- 42,59 ----
/* */
/***************************************************************/
#ifdef HAVE_PROTOS
! PUBLIC unsigned int HashVal(const char *str)
#else
! unsigned int HashVal(str)
char *str;
#endif
{
! register unsigned int i=0;
! register unsigned int j=1;
! register unsigned int len=0;
while(*str && len < VAR_NAME_LEN) {
! i += j * (unsigned int) UPPER(*str);
str++;
len++;
j = 3-j;
***************
*** 187,193 ****
v=FindVar(str, 0);
if (!v) {
! Eprint("Undefined variable: %s", str);
return E_NOSUCH_VAR;
}
return CopyValue(val, &v->v);
--- 191,197 ----
v=FindVar(str, 0);
if (!v) {
! Eprint("%s: %s", ErrMsg[E_NOSUCH_VAR], str);
return E_NOSUCH_VAR;
}
return CopyValue(val, &v->v);
***************
*** 273,279 ****
DumpVarTable();
return OK;
}
! fprintf(ErrFp, "%*s %s\n\n", VAR_NAME_LEN, "Variable", "Value");
while(1) {
if (*TokBuffer == '$') {
DumpSysVarByName(TokBuffer+1);
--- 277,283 ----
DumpVarTable();
return OK;
}
! fprintf(ErrFp, "%*s %s\n\n", VAR_NAME_LEN, VARIABLE, VALUE);
while(1) {
if (*TokBuffer == '$') {
DumpSysVarByName(TokBuffer+1);
***************
*** 280,286 ****
} else {
v = FindVar(TokBuffer, 0);
TokBuffer[VAR_NAME_LEN] = 0;
! if (!v) fprintf(ErrFp, "%*s *UNDEFINED*\n", VAR_NAME_LEN, TokBuffer);
else {
fprintf(ErrFp, "%*s ", VAR_NAME_LEN, v->name);
PrintValue(&(v->v), ErrFp);
--- 284,290 ----
} else {
v = FindVar(TokBuffer, 0);
TokBuffer[VAR_NAME_LEN] = 0;
! if (!v) fprintf(ErrFp, "%*s %s\n", VAR_NAME_LEN, TokBuffer, UNDEF);
else {
fprintf(ErrFp, "%*s ", VAR_NAME_LEN, v->name);
PrintValue(&(v->v), ErrFp);
***************
*** 309,315 ****
register Var *v;
register int i;
! fprintf(ErrFp, "%*s %s\n\n", VAR_NAME_LEN, "Variable", "Value");
for (i=0; i<VAR_HASH_SIZE; i++) {
v = VHashTbl[i];
--- 313,319 ----
register Var *v;
register int i;
! fprintf(ErrFp, "%*s %s\n\n", VAR_NAME_LEN, VARIABLE, VALUE);
for (i=0; i<VAR_HASH_SIZE; i++) {
v = VHashTbl[i];
***************
*** 442,448 ****
--- 446,454 ----
{ "DontFork", 0, &DontFork, 0, 0 },
{ "DontQueue", 0, &DontQueue, 0, 0 },
{ "DontTrigAts", 0, &DontIssueAts, 0, 0 },
+ { "FirstIndent", 1, &FirstIndent, 0, 132 },
{ "FoldYear", 1, &FoldYear, 0, 1 },
+ { "FormWidth", 1, &FormWidth, 20, 132 },
{ "HushMode", 0, &Hush, 0, 0 },
{ "IgnoreOnce", 0, &IgnoreOnce, 0, 0 },
{ "InfDelta", 0, &InfiniteDelta, 0, 0 },
***************
*** 459,465 ****
{ "NumTrig", 0, &NumTriggered, 0, 0 },
{ "PSCal", 0, &PsCal, 0, 0 },
{ "RunOff", 0, &RunDisabled, 0, 0 },
! { "SimpleCal", 0, &DoSimpleCalendar, 0, 0 }
};
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
--- 465,472 ----
{ "NumTrig", 0, &NumTriggered, 0, 0 },
{ "PSCal", 0, &PsCal, 0, 0 },
{ "RunOff", 0, &RunDisabled, 0, 0 },
! { "SimpleCal", 0, &DoSimpleCalendar, 0, 0 },
! { "SubsIndent", 1, &SubsIndent, 0, 132}
};
#define NUMSYSVARS ( sizeof(SysVarArr) / sizeof(SysVar) )
***************
*** 483,489 ****
SysVar *v = FindSysVar(name);
if (!v) return E_NOSUCH_VAR;
if (!v->modifiable) {
! Eprint("Cannot modify system variable '$%s'", name);
return E_CANT_MODIFY;
}
if (v->max != NO_CONSTRAINT && value > v->max) return E_2HIGH;
--- 490,496 ----
SysVar *v = FindSysVar(name);
if (!v) return E_NOSUCH_VAR;
if (!v->modifiable) {
! Eprint("%s: '$%s'", ErrMsg[E_CANT_MODIFY], name);
return E_CANT_MODIFY;
}
if (v->max != NO_CONSTRAINT && value > v->max) return E_2HIGH;
***************
*** 598,610 ****
if (v) {
if (!v->modifiable) fprintf(ErrFp, "%d\n", *v->value);
else {
! fprintf(ErrFp, "%-10d Allowed range: ", *v->value);
if (v->min == NO_CONSTRAINT) fprintf(ErrFp, "(-Inf, ");
else fprintf(ErrFp, "[%d, ", v->min);
if (v->max == NO_CONSTRAINT) fprintf(ErrFp, "Inf)\n");
else fprintf(ErrFp, "%d]\n", v->max);
}
! } else fprintf(ErrFp, "*UNDEFINED*\n");
return;
}
--- 605,617 ----
if (v) {
if (!v->modifiable) fprintf(ErrFp, "%d\n", *v->value);
else {
! fprintf(ErrFp, "%-10d ", *v->value);
if (v->min == NO_CONSTRAINT) fprintf(ErrFp, "(-Inf, ");
else fprintf(ErrFp, "[%d, ", v->min);
if (v->max == NO_CONSTRAINT) fprintf(ErrFp, "Inf)\n");
else fprintf(ErrFp, "%d]\n", v->max);
}
! } else fprintf(ErrFp, "%s\n", UNDEF);
return;
}