home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-12-17 | 56.7 KB | 1,848 lines |
- Newsgroups: comp.sources.misc
- From: <dfs@doe.carleton.ca> (David F. Skoll)
- Subject: v34i079: remind - A replacement for calendar, Patch01a/2
- Message-ID: <csm-v34i079=remind.152006@sparky.IMD.Sterling.COM>
- X-Md4-Signature: cd52f49172f2b2a8d6e9f66ba5b497e6
- Date: Fri, 18 Dec 1992 21:20:58 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: <dfs@doe.carleton.ca> (David F. Skoll)
- Posting-number: Volume 34, Issue 79
- Archive-name: remind/patch01a
- Environment: UNIX, MS-DOS
- Patch-To: remind: Volume 33, Issue 58-69
-
- This official patch will upgrade Remind 03.00.00 to Remind 03.00.01. Most
- changes are fixes to the code to improve portability. The major change
- is a new program to produce a calendar in PostScript format, which
- looks a lot better than the old ASCII calendar. Read the WHATSNEW.30
- file for details of all of the changes.
-
- To apply the patch: Unshar both parts into the Remind source directory,
- type "patch < patch.01", read the README file, and type "make."
-
- These files are available via anonymous ftp to ftp.doe.carleton.ca
- (134.117.9.33) in the directory /pub/remind-3.0. The files are:
-
- man-ps.tar.Z All the man pages in PostScript
- man-txt.tar.Z All the man pages in formatted ASCII text
- msdos-exe.tar.Z The MS-DOS executables
- patch01.tar.Z This patch
- remind-3.0.1.tar.Z The whole Remind 03.00.01 distribution.
-
- -------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: README.OS2 patch.01.B rem2ps.c remind.def
- # Wrapped by kent@sparky on Fri Dec 18 15:00:43 1992
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 1 (of 2)."'
- if test -f 'README.OS2' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README.OS2'\"
- else
- echo shar: Extracting \"'README.OS2'\" \(988 characters\)
- sed "s/^X//" >'README.OS2' <<'END_OF_FILE'
- XREMIND version 3.0 for OS/2
- X
- X1 - Read the file COPYRIGHT. (This may be called COPYRIGH on your
- X MS-DOS system.)
- X
- X2 - To compile Remind for OS/2, you must use the Microsoft C compiler.
- X You must also have a decent version of 'make', such as dmake.
- X
- X3 - Examine the file config.h and adjust parameters as needed
- X
- X4 - Examine the file makefile.os2 and adjust parameters as needed.
- X
- X5 - Type:
- X
- X make -f makefile.os2
- X
- XThis will make 'remind.exe' which is an OS/2 1.x--2.0 executable, and
- X'remindb.exe' which is an OS/2 and MSDOS bound executable.
- X
- XThe file "defs.rem" has some sample Remind definitions and commands.
- X
- XNOTE that I do not have access to an OS/2 system, so support for this
- Xsystem may not be as good as I'd like.
- X
- XOS/2 support is courtesy of DARREL HANKERSON <HANK@DUCVAX.AUBURN.EDU>.
- XHowever, if you have problems, please contact me and not Darrel.
- X
- X--
- XDavid F. Skoll <dfs@doe.carleton.ca>
- X4-317 LeBreton Street South
- XOttawa, Ontario K1S 4L4
- XCANADA
- X
- XTel. (613) 567-3662
- X
- END_OF_FILE
- if test 988 -ne `wc -c <'README.OS2'`; then
- echo shar: \"'README.OS2'\" unpacked with wrong size!
- fi
- # end of 'README.OS2'
- fi
- if test -f 'patch.01.B' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patch.01.B'\"
- else
- echo shar: Extracting \"'patch.01.B'\" \(34792 characters\)
- sed "s/^X//" >'patch.01.B' <<'END_OF_FILE'
- X*** ../p0/expr.h Mon Nov 9 14:12:08 1992
- X--- ./expr.h Wed Dec 16 10:51:24 1992
- X***************
- X*** 5,11 ****
- X /* Contains a few definitions used by expression evaluator. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1991 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X--- 5,11 ----
- X /* Contains a few definitions used by expression evaluator. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X*** ../p0/files.c Mon Nov 9 14:12:17 1992
- X--- ./files.c Wed Dec 16 10:51:33 1992
- X***************
- X*** 33,39 ****
- X #include <dos.h>
- X #endif
- X
- X- #include "config.h"
- X #include "types.h"
- X #include "protos.h"
- X #include "globals.h"
- X--- 33,38 ----
- X***************
- X*** 428,434 ****
- X /* file. Not needed for UNIX. */
- X /* */
- X /***************************************************************/
- X! #ifdef __MSDOS__
- X /*
- X * WARNING WARNING WARNING WARNING
- X * In the version of Turbo C which I have, there is a bug in the
- X--- 427,433 ----
- X /* file. Not needed for UNIX. */
- X /* */
- X /***************************************************************/
- X! #if defined(__MSDOS__) || defined(OS2)
- X /*
- X * WARNING WARNING WARNING WARNING
- X * In the version of Turbo C which I have, there is a bug in the
- X***************
- X*** 449,463 ****
- X int jul;
- X #endif
- X {
- X! int y, m, d;
- X #ifdef __TURBOC__
- X struct ftime ft;
- X- #endif
- X FILE *f;
- X
- X FromJulian(jul, &y, &m, &d);
- X-
- X- #ifdef __TURBOC__
- X ft.ft_tsec = 0;
- X ft.ft_min = 0;
- X ft.ft_hour = 12; /* Arbitrarily set time to noon. */
- X--- 448,460 ----
- X int jul;
- X #endif
- X {
- X!
- X #ifdef __TURBOC__
- X+ int y, m, d;
- X struct ftime ft;
- X FILE *f;
- X
- X FromJulian(jul, &y, &m, &d);
- X ft.ft_tsec = 0;
- X ft.ft_min = 0;
- X ft.ft_hour = 12; /* Arbitrarily set time to noon. */
- X***************
- X*** 464,488 ****
- X ft.ft_day = (unsigned int) d;
- X ft.ft_month = (unsigned int) m+1;
- X ft.ft_year = (unsigned int) (y - 1980);
- X- #endif
- X
- X! f = fopen(fname, "r");
- X!
- X! #ifdef __TURBOC__
- X if (!f || setftime(fileno(f) , &ft)) {
- X- #endif
- X
- X! #ifdef __MSC__
- X! if (!f || _dos_setftime(fileno(f),
- X! ((y-1980)<<9) + (m+1)<<5 + d,
- X! (12<<11))) {
- X #endif
- X fprintf(ErrFp, "Can't reset access date of %s\n", fname);
- X if (f) fclose(f);
- X return -1;
- X }
- X
- X fclose(f);
- X return 0;
- X }
- X #endif /* __MSDOS__ */
- X--- 461,485 ----
- X ft.ft_day = (unsigned int) d;
- X ft.ft_month = (unsigned int) m+1;
- X ft.ft_year = (unsigned int) (y - 1980);
- X
- X! f = fopen(fname, "r");
- X if (!f || setftime(fileno(f) , &ft)) {
- X
- X! #else /* Must be MSC */
- X! if (utime(fname, (struct utimbuf *) NULL)) {
- X #endif
- X fprintf(ErrFp, "Can't reset access date of %s\n", fname);
- X+
- X+ #ifdef __TURBOC__
- X if (f) fclose(f);
- X+ #endif
- X return -1;
- X }
- X
- X+ #ifdef __TURBOC__
- X fclose(f);
- X+ #endif
- X+
- X return 0;
- X }
- X #endif /* __MSDOS__ */
- X*** ../p0/funcs.c Mon Nov 9 14:23:22 1992
- X--- ./funcs.c Wed Dec 16 10:51:34 1992
- X***************
- X*** 6,16 ****
- X /* expressions. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1991 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X- #include <stdio.h>
- X #include "config.h"
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X--- 6,16 ----
- X /* expressions. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X #include "config.h"
- X+ #include <stdio.h>
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X***************
- X*** 26,32 ****
- X #include <sys/file.h>
- X #endif
- X #endif
- X- /* May have to change previous line to <sys/file.h> for some unixes */
- X #ifdef __MSDOS__
- X #include <io.h>
- X #define R_OK 4
- X--- 26,31 ----
- X***************
- X*** 127,134 ****
- X #define DCOPYVAL(x, y) ( (x) = (y), (y).type = ERR_TYPE )
- X
- X /* Convenience macros */
- X! #define UPPER(c) ( ((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c) )
- X! #define LOWER(c) ( ((c) >= 'A' && (c) <= 'Z') ? (c) + 'a' - 'A' : (c) )
- X
- X /* The array holding the built-in functions. */
- X Operator Func[] = {
- X--- 126,133 ----
- X #define DCOPYVAL(x, y) ( (x) = (y), (y).type = ERR_TYPE )
- X
- X /* Convenience macros */
- X! #define UPPER(c) (islower(c) ? toupper(c) : c)
- X! #define LOWER(c) (isupper(c) ? tolower(c) : c)
- X
- X /* The array holding the built-in functions. */
- X Operator Func[] = {
- X***************
- X*** 834,840 ****
- X
- X /***************************************************************/
- X /* */
- X! /* FOstype - the type of operating system (UNIX or MSDOS) */
- X /* */
- X /***************************************************************/
- X #ifdef HAVE_PROTOS
- X--- 833,840 ----
- X
- X /***************************************************************/
- X /* */
- X! /* FOstype - the type of operating system */
- X! /* (UNIX, OS/2, or MSDOS) */
- X /* */
- X /***************************************************************/
- X #ifdef HAVE_PROTOS
- X***************
- X*** 846,851 ****
- X--- 846,855 ----
- X #ifdef UNIX
- X return RetStrVal("UNIX");
- X #else
- X+ #ifdef __MSC__
- X+ if (_osmode == OS2_MODE)
- X+ return RetStrVal("OS/2");
- X+ #endif
- X return RetStrVal("MSDOS");
- X #endif
- X }
- X***************
- X*** 1362,1368 ****
- X PRIVATE FILE *popen(char *cmd, char *mode)
- X #else
- X static FILE *popen(cmd, mode)
- X! char *cmd, *mode
- X #endif
- X {
- X char *s;
- X--- 1366,1372 ----
- X PRIVATE FILE *popen(char *cmd, char *mode)
- X #else
- X static FILE *popen(cmd, mode)
- X! char *cmd, *mode;
- X #endif
- X {
- X char *s;
- X*** ../p0/globals.h Mon Nov 9 14:12:09 1992
- X--- ./globals.h Wed Dec 16 10:51:25 1992
- X***************
- X*** 7,13 ****
- X /* MK_GLOBALS. Also contains useful macro definitions. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1991 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X--- 7,13 ----
- X /* MK_GLOBALS. Also contains useful macro definitions. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X***************
- X*** 40,45 ****
- X--- 40,46 ----
- X EXTERN INIT( int DebugFlag, 0);
- X EXTERN INIT( char DoCalendar, 0);
- X EXTERN INIT( char DoSimpleCalendar, 0);
- X+ EXTERN INIT( char PsCal, 0);
- X EXTERN INIT( int CalWidth, 80);
- X EXTERN INIT( int CalWeeks, 0);
- X EXTERN INIT( int CalMonths, 0);
- X*** ../p0/init.c Mon Nov 9 14:12:19 1992
- X--- ./init.c Wed Dec 16 10:51:35 1992
- X***************
- X*** 36,41 ****
- X--- 36,42 ----
- X * -c[n] = Produce a calendar for n months (default = 1)
- X * -w[n] = Specify output device width (default = 80)
- X * -s[n] = Produce calendar in "simple calendar" format
- X+ * -p[n] = Produce calendar in format compatible with rem2ps
- X * -v = Verbose mode
- X * -o = Ignore ONCE directives
- X * -a = Don't issue timed reminders which will be queued
- X***************
- X*** 187,192 ****
- X--- 188,201 ----
- X if (!CalMonths) CalMonths = 1;
- X break;
- X
- X+ case 'p':
- X+ case 'P':
- X+ DoSimpleCalendar = 1;
- X+ PsCal = 1;
- X+ PARSENUM(CalMonths, arg);
- X+ if (!CalMonths) CalMonths = 1;
- X+ break;
- X+
- X case 'w':
- X case 'W':
- X PARSENUM(CalWidth, arg);
- X***************
- X*** 303,309 ****
- X #endif
- X {
- X fprintf(ErrFp, "\nREMIND %s Copyright 1992 by David F. Skoll\n\n", VERSION);
- X! fprintf(ErrFp, "Usage: remind [options] filename [date]\n\n");
- X fprintf(ErrFp, "Options:\n");
- X fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
- X fprintf(ErrFp, " -r Disable RUN directives\n");
- X--- 312,318 ----
- X #endif
- X {
- X fprintf(ErrFp, "\nREMIND %s Copyright 1992 by David F. Skoll\n\n", VERSION);
- X! fprintf(ErrFp, " Usage: remind [options] filename [date]\n");
- X fprintf(ErrFp, "Options:\n");
- X fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
- X fprintf(ErrFp, " -r Disable RUN directives\n");
- X***************
- X*** 311,316 ****
- X--- 320,326 ----
- X fprintf(ErrFp, " -c+[n] Produce a calendar for n (default 1) weeks\n");
- X fprintf(ErrFp, " -w[n] Specify width (default 80) of calendar output\n");
- X fprintf(ErrFp, " -s[n] Produce 'simple calendar' for n (1) months\n");
- X+ fprintf(ErrFp, " -p[n] Same as -s, but input compatible with rem2ps\n");
- X fprintf(ErrFp, " -v Verbose mode\n");
- X fprintf(ErrFp, " -o Ignore ONCE directives\n");
- X fprintf(ErrFp, " -t Trigger all future reminders regardless of delta\n");
- X*** ../p0/main.c Mon Nov 9 14:12:20 1992
- X--- ./main.c Wed Dec 16 10:51:37 1992
- X***************
- X*** 16,21 ****
- X--- 16,24 ----
- X #ifdef HAVE_MALLOC_H
- X #include <malloc.h>
- X #endif
- X+ #ifdef HAVE_UNISTD
- X+ #include <unistd.h>
- X+ #endif
- X #include <stdio.h>
- X #include <string.h>
- X #ifdef HAVE_STDARG
- X***************
- X*** 27,32 ****
- X--- 30,38 ----
- X
- X #ifdef __MSDOS__
- X #include <dos.h>
- X+ # ifdef __MSC__
- X+ # include <time.h>
- X+ # endif
- X #endif
- X
- X
- X***************
- X*** 101,108 ****
- X #endif
- X }
- X
- X! /* If it's MS-DOS, reset the file access date */
- X! #ifdef __MSDOS__
- X if (RealToday == JulianToday) SetAccessDate(InitialFile, RealToday);
- X #endif
- X
- X--- 107,114 ----
- X #endif
- X }
- X
- X! /* If it's MS-DOS or OS2, reset the file access date */
- X! #if defined(__MSDOS__) || defined(OS2)
- X if (RealToday == JulianToday) SetAccessDate(InitialFile, RealToday);
- X #endif
- X
- X***************
- X*** 569,575 ****
- X (void) vfprintf(ErrFp, fmt, argptr);
- X (void) fputc('\n', ErrFp);
- X #ifndef HAVE_STDARG
- X! va_end(argptr)
- X #endif
- X return;
- X }
- X--- 575,581 ----
- X (void) vfprintf(ErrFp, fmt, argptr);
- X (void) fputc('\n', ErrFp);
- X #ifndef HAVE_STDARG
- X! va_end(argptr);
- X #endif
- X return;
- X }
- X***************
- X*** 676,683 ****
- X long SystemTime()
- X #endif
- X {
- X! #ifdef __MSDOS__
- X! #ifdef __TURBOC__
- X /* Get time in Turbo C */
- X
- X struct time t;
- X--- 682,688 ----
- X long SystemTime()
- X #endif
- X {
- X! #if defined( __MSDOS__ ) && defined( __TURBOC__ )
- X /* Get time in Turbo C */
- X
- X struct time t;
- X***************
- X*** 685,701 ****
- X gettime(&t);
- X return (long) t.ti_hour * 3600L + (long) t.ti_min * 60L +
- X (long) t.ti_sec;
- X-
- X #else
- X! /* Get time in Microsoft C */
- X! struct dostime_t tloc;
- X! _dos_gettime(&tloc);
- X! return (long) tloc.hour * 3600L + (long) tloc.minute * 60L +
- X! (long) tloc.second;
- X!
- X! #endif
- X! #else
- X! /* Get time in Unix */
- X time_t tloc;
- X struct tm *t;
- X
- X--- 690,697 ----
- X gettime(&t);
- X return (long) t.ti_hour * 3600L + (long) t.ti_min * 60L +
- X (long) t.ti_sec;
- X #else
- X! /* Get time in Unix or with MSC */
- X time_t tloc;
- X struct tm *t;
- X
- X***************
- X*** 723,730 ****
- X int *y;
- X #endif
- X {
- X! #ifdef __MSDOS__
- X! #ifdef __TURBOC__
- X /* Get today's date in Turbo C */
- X struct date da;
- X
- X--- 719,725 ----
- X int *y;
- X #endif
- X {
- X! #if defined( __MSDOS__ ) && defined( __TURBOC__ )
- X /* Get today's date in Turbo C */
- X struct date da;
- X
- X***************
- X*** 733,751 ****
- X *m = da.da_mon - 1;
- X *d = da.da_day;
- X #else
- X! /* Get today's date in Microsoft C */
- X! struct dosdate_t buf;
- X!
- X! _dos_getdate(&buf);
- X!
- X! *d = buf.day;
- X! *m = buf.month - 1;
- X! *y = buf.year;
- X! #endif
- X! #else
- X! /* Get today's date in UNIX */
- X! time_t tloc;
- X! struct tm *t;
- X
- X (void) time(&tloc);
- X t = localtime(&tloc);
- X--- 728,736 ----
- X *m = da.da_mon - 1;
- X *d = da.da_day;
- X #else
- X! /* Get today's date in UNIX or with MSC */
- X! time_t tloc;
- X! struct tm *t;
- X
- X (void) time(&tloc);
- X t = localtime(&tloc);
- X*** ../p0/makefile.msc Mon Nov 9 14:12:34 1992
- X--- ./makefile.msc Wed Dec 16 10:51:53 1992
- X***************
- X*** 55,57 ****
- X--- 55,64 ----
- X
- X remind.exe: $(OBJS)
- X link /NOI @lnk.msc
- X+
- X+ rem2ps.obj: rem2ps.c
- X+ cl /c $(DEFINES) $(MODEL) /Forem2ps.obj rem2ps.c
- X+
- X+ rem2ps.exe: rem2ps.obj
- X+ link /NOI rem2ps,rem2ps.exe,,,
- X+
- X*** ../p0/makefile.tc Mon Nov 9 14:12:33 1992
- X--- ./makefile.tc Wed Dec 16 10:51:51 1992
- X***************
- X*** 1,6 ****
- X # Makefile for REMIND for Turbo C for MSDOS
- X
- X! VERSION= 03.00.00
- X
- X HDRS= config.h err.h expr.h globals.h protos.h types.h version.h
- X
- X--- 1,6 ----
- X # Makefile for REMIND for Turbo C for MSDOS
- X
- X! VERSION= 03.00.01
- X
- X HDRS= config.h err.h expr.h globals.h protos.h types.h version.h
- X
- X***************
- X*** 15,27 ****
- X
- X MANIFEST= readme.uni readme.dos copyrigh $(HDRS) $(SRCS) makefile rem rem.1 \
- X remind.1 remind-a.csh remind-a.sh test.rem test-rem test.cmp makefile.tc \
- X! makefile.msc lnk.msc lnk.tc manifest.dos manifest.unx whatsnew.30 kall kall.1
- X
- X remind.exe: $(OBJS)
- X tcc @lnk.tc
- X
- X .c.obj:
- X tcc -A -w-pia -c -O -ms {$< }
- X
- X calendar.obj: calendar.c $(STDHDRS) expr.h
- X
- X--- 15,35 ----
- X
- X MANIFEST= readme.uni readme.dos copyrigh $(HDRS) $(SRCS) makefile rem rem.1 \
- X remind.1 remind-a.csh remind-a.sh test.rem test-rem test.cmp makefile.tc \
- X! makefile.msc lnk.msc lnk.tc manifest.dos manifest.unx whatsnew.30 kall kall.1 \
- X! defs.rem readme.os2 makefile.os2 rem2ps.c rem2ps.h remind.def rem2ps.1
- X
- X+ all: remind.exe rem2ps.exe
- X+
- X remind.exe: $(OBJS)
- X tcc @lnk.tc
- X
- X+ rem2ps.exe: rem2ps.obj
- X+ tcc -erem2ps.exe rem2ps.obj
- X+
- X .c.obj:
- X tcc -A -w-pia -c -O -ms {$< }
- X+
- X+ rem2ps.obj: rem2ps.c rem2ps.h config.h
- X
- X calendar.obj: calendar.c $(STDHDRS) expr.h
- X
- X*** ../p0/protos.h Mon Nov 9 14:12:10 1992
- X--- ./protos.h Wed Dec 16 10:51:26 1992
- X***************
- X*** 5,11 ****
- X /* Function Prototypes. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1991 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X #ifdef HAVE_PROTOS
- X--- 5,11 ----
- X /* Function Prototypes. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X #ifdef HAVE_PROTOS
- X***************
- X*** 110,112 ****
- X--- 110,113 ----
- X int DoPreserve ARGS ((Parser *p));
- X int DoSatRemind ARGS ((Trigger *trig, TimeTrig *tim, ParsePtr p));
- X int ParseNonSpaceChar ARGS ((ParsePtr p, int *err, int peek));
- X+ int HashVal ARGS ((const char *str));
- X*** ../p0/queue.c Mon Nov 9 14:12:22 1992
- X--- ./queue.c Wed Dec 16 10:51:38 1992
- X***************
- X*** 8,18 ****
- X /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X #include <stdio.h>
- X #include <signal.h>
- X #include <sys/types.h>
- X #include <sys/stat.h>
- X- #include "config.h"
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X--- 8,18 ----
- X /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X+ #include "config.h"
- X #include <stdio.h>
- X #include <signal.h>
- X #include <sys/types.h>
- X #include <sys/stat.h>
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X***************
- X*** 19,24 ****
- X--- 19,27 ----
- X #ifdef HAVE_MALLOC_H
- X #include <malloc.h>
- X #endif
- X+ #ifdef HAVE_UNISTD
- X+ #include <unistd.h>
- X+ #endif
- X #include "globals.h"
- X #include "err.h"
- X #include "types.h"
- X***************
- X*** 174,179 ****
- X--- 177,183 ----
- X /* Trigger the reminder */
- X CreateParser(q->text, &p);
- X trig.typ = q->typ;
- X+ RunDisabled = q->RunDisabled;
- X (void) TriggerReminder(&p, &trig, &q->tt, JulianToday);
- X fflush(stdout);
- X
- X*** ../p0/remind.1 Mon Nov 9 14:12:29 1992
- X--- ./remind.1 Wed Dec 16 10:51:48 1992
- X***************
- X*** 1,4 ****
- X! .TH REMIND 1 "20 October 1992"
- X .UC4
- X .SH NAME
- X remind \- a sophisticated reminder service
- X--- 1,4 ----
- X! .TH REMIND 1 "11 November 1992"
- X .UC4
- X .SH NAME
- X remind \- a sophisticated reminder service
- X***************
- X*** 38,43 ****
- X--- 38,48 ----
- X format" which can be used as input for more sophisticated calendar-drawing
- X programs.
- X .TP
- X+ .B \-p\fR\fIn\fR
- X+ The \fB\-p\fR option is very similar to the \fB\-s\fR option, except
- X+ that the output contains additional information for use by the
- X+ \fBrem2ps\fR program, which creates a PostScript calendar.
- X+ .TP
- X .B \-v
- X The \fB\-v\fR option makes the output of \fBRemind\fR slightly more verbose.
- X .TP
- X***************
- X*** 1149,1163 ****
- X .RE
- X .TP
- X .B DATE constants
- X! \fBDATE\fR constants have no readable representation. They must be
- X! created with the \fBdate()\fR function, which takes the year, month
- X! and day as arguments:
- X .PP
- X .RS
- X! date(1992, 2, 29), date(1996, 4, 2), date(2001, 12, 17)
- X .PP
- X! However, \fBDATE\fR constants are \fIprinted\fR as
- X! \fIyyyy\fR/\fImm\fR/\fIdd\fR.
- X .RE
- X .PP
- X .B OPERATORS
- X--- 1154,1170 ----
- X .RE
- X .TP
- X .B DATE constants
- X! \fBDATE\fR constants are expressed as 'yyyy/mm/dd', and the single
- X! quotes \fImust\fR be supplied. This distinguishes date constants
- X! from division of integers. Examples:
- X .PP
- X .RS
- X! '1993/02/22', '1992/12/25', '1999/01/01'
- X .PP
- X! Note that \fBDATE\fR constants are \fIprinted\fR as
- X! \fIyyyy\fR/\fImm\fR/\fIdd\fR without the quotes. Note also that versions
- X! of \fBRemind\fR prior to 03.00.01 did not support date constants. In those
- X! versions, you must create dates using the \fBdate()\fR function.
- X .RE
- X .PP
- X .B OPERATORS
- X***************
- X*** 1372,1377 ****
- X--- 1379,1389 ----
- X a \fBSTRING\fR consisting of the characters specified by the arguments.
- X Note that none of the arguments can be 0, unless there is only one
- X argument. As a special case, \fBchar(0)\fR returns "".
- X+ .PP
- X+ Note that because \fBRemind\fR does not support escaping of characters
- X+ in strings, the only way to get a double-quote in a string is to use
- X+ \fBchar(34)\fR. Yes, I know it's not portable - it assumes ASCII
- X+ coding.
- X .TP
- X .B choose(i_index, x_arg1 [,x_arg2...])
- X \fBChoose\fR must take at least two arguments, the first of which is
- X***************
- X*** 1525,1531 ****
- X \fBord(2)\fR returns "2nd", and \fBord(213)\fR returns "213th".
- X .TP
- X .B ostype()
- X! Returns "UNIX" on UNIX systems, and "MSDOS" on MS-DOS systems.
- X .TP
- X .B plural(i_num [,s_str1 [,s_str2]])
- X Can take from one to three arguments. If one argument is supplied, returns
- X--- 1537,1545 ----
- X \fBord(2)\fR returns "2nd", and \fBord(213)\fR returns "213th".
- X .TP
- X .B ostype()
- X! Returns "UNIX" on UNIX systems, "MSDOS" on MS-DOS systems, and "OS/2"
- X! on OS/2 systems. If you run \fBRemind\fR in an MS-DOS box under OS/2,
- X! this function returns "MSDOS".
- X .TP
- X .B plural(i_num [,s_str1 [,s_str2]])
- X Can take from one to three arguments. If one argument is supplied, returns
- X***************
- X*** 1615,1621 ****
- X .TP
- X .B version()
- X Returns a string specifying the version of \fBRemind\fR. For version
- X! 03.00.00, returns "03.00.00". It is guaranteed that as new versions of
- X \fBRemind\fR are released, the value returned by \fBversion()\fR will
- X strictly increase, according to the rules for string ordering.
- X .TP
- X--- 1629,1635 ----
- X .TP
- X .B version()
- X Returns a string specifying the version of \fBRemind\fR. For version
- X! 03.00.01, returns "03.00.01". It is guaranteed that as new versions of
- X \fBRemind\fR are released, the value returned by \fBversion()\fR will
- X strictly increase, according to the rules for string ordering.
- X .TP
- X***************
- X*** 2009,2024 ****
- X .PP
- X .SH CALENDAR MODE
- X .PP
- X! If you supply the \fB\-c\fR or \fB\-s\fR command-line option, the \fBRemind\fR
- X runs in "calendar mode." In this mode, \fBRemind\fR interprets the script
- X repeatedly, performing one iteration through the whole file for each day
- X in the calendar. Reminders which trigger are saved in internal buffers,
- X and then inserted into the calendar in the appropriate places.
- X .PP
- X! For example, if you have a reminder script called ".reminders", and you
- X! executed this command:
- X .PP
- X .nf
- X remind -c .reminders jan 1993
- X .fi
- X .PP
- X--- 2023,2049 ----
- X .PP
- X .SH CALENDAR MODE
- X .PP
- X! If you supply the \fB\-c\fR, \fB\-s\fR or \fB\-p\fR
- X! command-line option, then \fBRemind\fR
- X runs in "calendar mode." In this mode, \fBRemind\fR interprets the script
- X repeatedly, performing one iteration through the whole file for each day
- X in the calendar. Reminders which trigger are saved in internal buffers,
- X and then inserted into the calendar in the appropriate places.
- X .PP
- X! The \fB\-p\fR option is used in conjunction with the \fBrem2ps\fR
- X! program to produce a calendar in PostScript format. For example, the
- X! following command will send PostScript code to standard output:
- X .PP
- X .nf
- X+ remind -p .reminders | rem2ps
- X+ .fi
- X+ .PP
- X+ You can print a PostScript calendar by piping this to the \fBlpr\fR command.
- X+ .PP
- X+ If you have a reminder script called ".reminders", and you
- X+ execute this command:
- X+ .PP
- X+ .nf
- X remind -c .reminders jan 1993
- X .fi
- X .PP
- X***************
- X*** 2205,2210 ****
- X--- 2230,2249 ----
- X that the trigger date is issued only in election years, which are
- X multiples of 4. The second \fBREM\fR command actually issues the
- X reminder.
- X+ .PP
- X+ .B DETAILS ABOUT TRIGVALID()
- X+ .PP
- X+ The \fBtrigvalid()\fR function returns 1 if \fBRemind\fR could find a trigger
- X+ date for the previous \fBREM\fR or \fBIFTRIG\fR command. More specifically,
- X+ it returns 1 if \fBRemind\fR finds a date \fInot in the past\fR which
- X+ satisfies the trigger. In addition, there is one special case in which
- X+ \fBtrigvalid()\fR returns 1 and \fBtrigdate()\fR returns a meaningful result:
- X+ .PP
- X+ If the \fBREM\fR or \fBIFTRIG\fR command did not contain an \fBUNTIL\fR
- X+ clause, and contained all of the \fIday\fR, \fImonth\fR and \fIyear\fR
- X+ components, then \fBRemind\fR will correctly compute a trigger date, even
- X+ if it happens to be in the past. Note that this behaviour is not true for
- X+ versions of \fBRemind\fR prior to 03.00.01.
- X .SH AUTHOR
- X .PP
- X David F. Skoll
- X***************
- X*** 2212,2218 ****
- X .PP
- X Date calculation is a bit "brute force."
- X .PP
- X! The MS-DOS version of \fBRemind\fR does not support queuing or timed
- X activation of reminders.
- X .PP
- X \fBRemind\fR has some built-in limits on total line length,
- X--- 2251,2257 ----
- X .PP
- X Date calculation is a bit "brute force."
- X .PP
- X! The MS-DOS and OS/2 versions of \fBRemind\fR do not support queuing or timed
- X activation of reminders.
- X .PP
- X \fBRemind\fR has some built-in limits on total line length,
- X***************
- X*** 2220,2223 ****
- X .PP
- X .SH SEE ALSO
- X .pp
- X! rem, elm, kall
- X--- 2259,2262 ----
- X .PP
- X .SH SEE ALSO
- X .pp
- X! rem, elm, kall, rem2ps
- X*** ../p0/test-rem Mon Nov 9 14:12:33 1992
- X--- ./test-rem Wed Dec 16 10:51:51 1992
- X***************
- X*** 1,8 ****
- X! #!/bin/csh -f
- X! setenv TEST_GETENV "foo bar baz"
- X ./remind -e -dxtev ./test.rem 16 feb 1991 > ./test.out
- X cmp -s ./test.out ./test.cmp
- X! if ($status == 0) then
- X echo "Remind: Acceptance test PASSED"
- X exit 0
- X else
- X--- 1,8 ----
- X! #!/bin/sh
- X! TEST_GETENV="foo bar baz" ; export TEST_GETENV
- X ./remind -e -dxtev ./test.rem 16 feb 1991 > ./test.out
- X cmp -s ./test.out ./test.cmp
- X! if [ "$?" = "0" ]; then
- X echo "Remind: Acceptance test PASSED"
- X exit 0
- X else
- X***************
- X*** 11,14 ****
- X echo "Examine the file test.out to see where it differs from the"
- X echo "reference file test.cmp."
- X exit 1
- X! endif
- X--- 11,14 ----
- X echo "Examine the file test.out to see where it differs from the"
- X echo "reference file test.cmp."
- X exit 1
- X! fi
- X*** ../p0/test.cmp Mon Nov 9 14:12:33 1992
- X--- ./test.cmp Wed Dec 16 10:51:51 1992
- X***************
- X*** 349,355 ****
- X "a05" + "6" => "a056"
- X value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
- X set a058 version()
- X! version() => "03.00.00"
- X set a059 wkday(today())
- X today() => 1991/02/16
- X wkday(1991/02/16) => "Saturday"
- X--- 349,355 ----
- X "a05" + "6" => "a056"
- X value("a056") => "SDFJHSDF KSJDFH KJSDFH KSJDFH"
- X set a058 version()
- X! version() => "03.00.01"
- X set a059 wkday(today())
- X today() => 1991/02/16
- X wkday(1991/02/16) => "Saturday"
- X***************
- X*** 453,459 ****
- X a048 "foo"
- X a067 "INT"
- X a039 "February"
- X! a058 "03.00.00"
- X a049 21
- X a068 "STRING"
- X a059 "Saturday"
- X--- 453,459 ----
- X a048 "foo"
- X a067 "INT"
- X a039 "February"
- X! a058 "03.00.01"
- X a049 21
- X a068 "STRING"
- X a059 "Saturday"
- X*** ../p0/token.c Mon Nov 9 14:12:22 1992
- X--- ./token.c Wed Dec 16 10:51:39 1992
- X***************
- X*** 6,17 ****
- X /* classifying the tokens parsed. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1991 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X #include <stdio.h>
- X #include <ctype.h>
- X- #include "config.h"
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X--- 6,17 ----
- X /* classifying the tokens parsed. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X+ #include "config.h"
- X #include <stdio.h>
- X #include <ctype.h>
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X*** ../p0/trigger.c Mon Nov 9 14:12:23 1992
- X--- ./trigger.c Wed Dec 16 10:51:40 1992
- X***************
- X*** 5,16 ****
- X /* Routines for figuring out the trigger date of a reminder */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1991 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X- #include <stdio.h>
- X #include "config.h"
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X--- 5,16 ----
- X /* Routines for figuring out the trigger date of a reminder */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X #include "config.h"
- X+ #include <stdio.h>
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X***************
- X*** 439,448 ****
- X--- 439,456 ----
- X fprintf(ErrFp, "%s(%d): Expired\n",
- X FileName, LineNo);
- X }
- X+ if (result != -1) {
- X+ LastTriggerDate = result;
- X+ LastTrigValid = 1;
- X+ }
- X return -1;
- X }
- X /* Keep scanning... unless there's no point in doing it.*/
- X if (nextstart <= start) {
- X+ if (result != -1) {
- X+ LastTriggerDate = result;
- X+ LastTrigValid = 1;
- X+ }
- X if (DebugFlag & DB_PRTTRIG) {
- X fprintf(ErrFp, "%s(%d): Expired\n",
- X FileName, LineNo);
- X*** ../p0/types.h Mon Nov 9 14:12:10 1992
- X--- ./types.h Wed Dec 16 10:51:26 1992
- X***************
- X*** 5,11 ****
- X /* Type definitions all dumped here. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1991 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X /* Values */
- X--- 5,11 ----
- X /* Type definitions all dumped here. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X /* Values */
- X*** ../p0/utils.c Mon Nov 9 14:12:24 1992
- X--- ./utils.c Wed Dec 16 10:51:41 1992
- X***************
- X*** 5,17 ****
- X /* Useful utility functions. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1991 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X #include <string.h>
- X #include <stdio.h>
- X- #include "config.h"
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X--- 5,17 ----
- X /* Useful utility functions. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X+ #include "config.h"
- X #include <string.h>
- X #include <stdio.h>
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X***************
- X*** 18,25 ****
- X #ifdef HAVE_MALLOC_H
- X #include <malloc.h>
- X #endif
- X
- X! #define UPPER(c) ( ((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c) )
- X
- X /***************************************************************/
- X /* */
- X--- 18,26 ----
- X #ifdef HAVE_MALLOC_H
- X #include <malloc.h>
- X #endif
- X+ #include <ctype.h>
- X
- X! #define UPPER(c) (islower(c) ? toupper(c) : c)
- X
- X /***************************************************************/
- X /* */
- X*** ../p0/var.c Mon Nov 9 14:12:25 1992
- X--- ./var.c Wed Dec 16 10:51:42 1992
- X***************
- X*** 6,17 ****
- X /* user- and system-defined variables. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1991 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X- #include <stdio.h>
- X #include "config.h"
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X--- 6,17 ----
- X /* user- and system-defined variables. */
- X /* */
- X /* This file is part of REMIND. */
- X! /* Copyright (C) 1992 by David F. Skoll. */
- X /* */
- X /***************************************************************/
- X
- X #include "config.h"
- X+ #include <stdio.h>
- X #ifdef HAVE_STDLIB_H
- X #include <stdlib.h>
- X #endif
- X***************
- X*** 18,23 ****
- X--- 18,24 ----
- X #ifdef HAVE_MALLOC_H
- X #include <malloc.h>
- X #endif
- X+ #include <ctype.h>
- X #include "types.h"
- X #include "expr.h"
- X #include "globals.h"
- X***************
- X*** 24,30 ****
- X #include "protos.h"
- X #include "err.h"
- X
- X! #define UPPER(c) ( ((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c) )
- X
- X /* The variable hash table */
- X #define VAR_HASH_SIZE 64
- X--- 25,31 ----
- X #include "protos.h"
- X #include "err.h"
- X
- X! #define UPPER(c) (islower(c) ? toupper(c) : c)
- X
- X /* The variable hash table */
- X #define VAR_HASH_SIZE 64
- X***************
- X*** 377,383 ****
- X
- X /***************************************************************/
- X /* */
- X! /* DoPreserve - delete a bunch of variables. */
- X /* */
- X /***************************************************************/
- X #ifdef HAVE_PROTOS
- X--- 378,384 ----
- X
- X /***************************************************************/
- X /* */
- X! /* DoPreserve - preserve a bunch of variables. */
- X /* */
- X /***************************************************************/
- X #ifdef HAVE_PROTOS
- END_OF_FILE
- if test 34792 -ne `wc -c <'patch.01.B'`; then
- echo shar: \"'patch.01.B'\" unpacked with wrong size!
- elif test -f 'patch.01.A'; then
- echo shar: Combining \"'patch.01'\" \(67490 characters\)
- cat 'patch.01.A' 'patch.01.B' > 'patch.01'
- if test 67490 -ne `wc -c <'patch.01'`; then
- echo shar: \"'patch.01'\" combined with wrong size!
- else
- rm patch.01.A patch.01.B
- fi
- fi
- # end of 'patch.01.B'
- fi
- if test -f 'rem2ps.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'rem2ps.c'\"
- else
- echo shar: Extracting \"'rem2ps.c'\" \(16502 characters\)
- sed "s/^X//" >'rem2ps.c' <<'END_OF_FILE'
- X/***************************************************************/
- X/* */
- X/* REM2PS.C */
- X/* */
- X/* Print a PostScript calendar. */
- X/* */
- X/* This file is part of REMIND. */
- X/* Copyright (C) 1992 by David F. Skoll. */
- X/* */
- X/***************************************************************/
- X#include "config.h"
- X#include <stdio.h>
- X#include <string.h>
- X#include <ctype.h>
- X#ifdef HAVE_UNISTD
- X#include <unistd.h>
- X#endif
- X#include "rem2ps.h"
- X#ifdef HAVE_MALLOC_H
- X#include <malloc.h>
- X#endif
- X#ifdef HAVE_STDLIB_H
- X#include <stdlib.h>
- X#endif
- X
- X#ifdef HAVE_PROTOS
- X#define ARGS(x) x
- X#else
- X#define ARGS(x) ()
- X#endif
- X#define NEW(type) ((type *) malloc(sizeof(type)))
- X
- Xtypedef struct _CalEntry {
- X struct _CalEntry *next;
- X char *entry;
- X} CalEntry;
- X
- Xtypedef struct {
- X char *name;
- X int xsize, ysize;
- X} PageType;
- X
- Xchar Days[]="SMTWTFS";
- X
- XPageType Pages[] =
- X{
- X {"Letter", 612, 792}, /* 8.5 x 11 in. */
- X {"Tabloid", 792, 1224}, /* 11 x 17 in. */
- X {"Ledger", 1224, 792}, /* 17 x 11 in. */
- X {"Legal", 612, 1008}, /* 8.5 x 14 in. */
- X {"Statement", 396, 612}, /* 5.5 x 8.5 in. */
- X {"Executive", 540, 720}, /* 7.5 x 10 in. */
- X {"A3", 842, 1190},
- X {"A4", 595, 842},
- X {"A5", 420, 595},
- X {"B4", 729, 1032},
- X {"B5", 519, 729},
- X {"Folio", 612, 936},
- X {"Quarto", 612, 780},
- X {"10x14", 720, 1008}
- X};
- X
- X#define NUMPAGES (sizeof(Pages)/sizeof(Pages[0]))
- X
- XCalEntry *CurEntries;
- XPageType *CurPage;
- Xchar PortraitMode;
- Xchar NoSmallCal;
- X
- Xchar LineBuffer[LINELEN];
- X
- Xchar *HeadFont="Helvetica";
- Xchar *DayFont="Helvetica-BoldOblique";
- Xchar *EntryFont="Helvetica";
- Xchar *SmallFont="Helvetica";
- Xchar *LineWidth = "1";
- X
- Xchar *HeadSize="14";
- Xchar *DaySize="14";
- Xchar *EntrySize="8";
- Xchar *BorderSize = "6";
- X
- Xint validfile = 0;
- X
- Xint CurDay;
- Xint MaxDay;
- Xint DayNum;
- Xint WkDayNum;
- X
- Xvoid Init ARGS ((int argc, char *argv[]));
- Xvoid Usage ARGS ((char *s));
- Xvoid DoPsCal ARGS ((void));
- Xvoid DoSmallCal ARGS((char *m, int days, int first, int col));
- Xvoid WriteProlog ARGS ((void));
- Xvoid WriteCalEntry ARGS ((void));
- Xvoid WriteOneEntry ARGS ((char *s));
- X
- X/***************************************************************/
- X/* */
- X/* MAIN PROGRAM */
- X/* */
- X/***************************************************************/
- X#ifdef HAVE_PROTOS
- XPUBLIC int main(int argc, char *argv[])
- X#else
- Xint main(argc, argv)
- Xint argc;
- Xchar argv[];
- X#endif
- X{
- X /* If stdin is a tty - probably wrong. */
- X
- X Init(argc, argv);
- X
- X if (isatty(0)) {
- X Usage("Input should not come from a terminal");
- X }
- X
- X /* Search for a valid input file */
- X while (!feof(stdin)) {
- X gets(LineBuffer);
- X if (!strcmp(LineBuffer, PSBEGIN)) {
- X if (!validfile) WriteProlog();
- X validfile++;
- X DoPsCal();
- X }
- X }
- X if (!validfile) {
- X fprintf(stderr, "Couldn't find any calendar data!\n");
- X exit(1);
- X }
- X printf("%%%%Trailer\n");
- X printf("%%%%Pages: %d\n", validfile);
- X return 0;
- X}
- X
- X/***************************************************************/
- X/* */
- X/* DoPsCal - emit PostScript for the calendar. */
- X/* */
- X/***************************************************************/
- X#ifdef HAVE_PROTOS
- Xvoid DoPsCal(void)
- X#else
- Xvoid DoPsCal()
- X#endif
- X{
- X char month[40], year[40];
- X char prevm[40], nextm[40];
- X int days, wkday, prevdays, nextdays;
- X int sfirst;
- X int i;
- X int smallcol;
- X CalEntry *c, *d;
- X
- X printf("%%%%Page: %d %d\n", validfile, validfile);
- X/* Read the month and year name, followed by # days in month and 1st day of
- X month */
- X gets(LineBuffer);
- X sscanf(LineBuffer, "%s %s %d %d", month, year, &days, &wkday);
- X gets(LineBuffer);
- X sscanf(LineBuffer, "%s %d", prevm, &prevdays);
- X gets(LineBuffer);
- X sscanf(LineBuffer, "%s %d", nextm, &nextdays);
- X MaxDay = days;
- X
- X/* Emit PostScript to do the heading */
- X if (!PortraitMode) printf("XSIZE 0 translate 90 rotate\n");
- X printf("(%s %s) doheading\n", month, year);
- X
- X/* Calculate the minimum box size */
- X printf("/MinBoxSize ytop MinY sub 7 div def\n");
- X
- X/* If wkday >= 2, then do the small calendars at the top. */
- X if (wkday >=2 && !NoSmallCal) {
- X smallcol = 0;
- X printf("/ysmall ytop def\n");
- X }
- X
- X/* Do each entry */
- X
- X CurEntries = NULL;
- X CurDay = 1;
- X WkDayNum = wkday;
- X
- X while(1) {
- X gets(LineBuffer);
- X if (!strcmp(LineBuffer, PSEND)) break;
- X
- X/* Read the day number - a bit of a hack! */
- X DayNum = (LineBuffer[8] - '0') * 10 + LineBuffer[9] - '0';
- X if (DayNum != CurDay) {
- X for(; CurDay<DayNum; CurDay++) {
- X WriteCalEntry();
- X WkDayNum = (WkDayNum + 1) % 7;
- X }
- X }
- X/* Add the text */
- X c = NEW(CalEntry);
- X if (!c) {
- X fprintf(stderr, "malloc failed - aborting.\n");
- X exit(1);
- X }
- X c->next = NULL;
- X c->entry = malloc(strlen(LineBuffer+10) + 1);
- X if (!c->entry) {
- X fprintf(stderr, "malloc failed - aborting.\n");
- X exit(1);
- X }
- X strcpy(c->entry, LineBuffer+10);
- X
- X/* Put on linked list */
- X if (!CurEntries) CurEntries = c;
- X else {
- X d = CurEntries;
- X while(d->next) d = d->next;
- X d->next = c;
- X }
- X }
- X for(; CurDay<=days; CurDay++) {
- X WriteCalEntry();
- X WkDayNum = (WkDayNum + 1) % 7;
- X }
- X
- X/* If wkday < 2, set ysmall. If necessary (only for feb) increase cal size. */
- X if (wkday < 2 && !NoSmallCal) {
- X smallcol = 5;
- X printf("/ysmall ylast def\n");
- X if (days == 28 && wkday == 0) {
- X printf("/ysmall ymin def /ymin ysmall MinBoxSize sub def\n");
- X printf("MinX ymin MaxX ymin L\n");
- X }
- X }
- X
- X
- X/* Now draw the vertical lines */
- X for (i=0; i<=7; i++) {
- X printf("%d xincr mul MinX add ymin %d xincr mul MinX add topy L\n",
- X i, i);
- X }
- X
- X/* print the small calendars */
- X if (!NoSmallCal) {
- X sfirst = wkday - (prevdays % 7);
- X if (sfirst < 0) sfirst += 7;
- X DoSmallCal(prevm, prevdays, sfirst, smallcol);
- X sfirst = wkday + (days % 7);
- X if (sfirst >6) sfirst -= 7;
- X DoSmallCal(nextm, nextdays, sfirst, smallcol+1);
- X }
- X/* Do it! */
- X printf("showpage\n");
- X}
- X
- X/***************************************************************/
- X/* */
- X/* WriteProlog - write the PostScript prologue */
- X/* */
- X/***************************************************************/
- X#ifdef HAVE_PROTOS
- Xvoid WriteProlog(void)
- X#else
- Xvoid WriteProlog()
- X#endif
- X{
- X int i;
- X int x = CurPage->xsize;
- X int y = CurPage->ysize;
- X
- X if (!PortraitMode) {
- X i = x; x = y; y = i;
- X }
- X
- X/* Write the document structuring stuff */
- X printf("%%!PS-Adobe-\n");
- X printf("%%%%DocumentFonts: %s", HeadFont);
- X if (strcmp(HeadFont, DayFont)) printf(" %s", DayFont);
- X if (strcmp(EntryFont, HeadFont) &&
- X strcmp(EntryFont, DayFont)) printf(" %s", EntryFont);
- X if (!NoSmallCal && strcmp(SmallFont, HeadFont) &&
- X strcmp(SmallFont, DayFont) &&
- X strcmp(SmallFont, EntryFont)) printf(" %s", SmallFont);
- X putchar('\n');
- X printf("%%%%Creator: Rem2PS\n");
- X printf("%%%%Pages: (atend)\n");
- X printf("%%%%EndComments\n");
- X for (i=0; PSProlog[i]; i++) puts(PSProlog[i]);
- X printf("/HeadFont /%s def\n", HeadFont);
- X if (!NoSmallCal) printf("/SmallFont /%s def\n", SmallFont);
- X printf("/DayFont /%s def\n", DayFont);
- X printf("/EntryFont /%s def\n", EntryFont);
- X printf("/HeadSize %s def\n", HeadSize);
- X printf("/DaySize %s def\n", DaySize);
- X printf("/EntrySize %s def\n", EntrySize);
- X printf("/XSIZE %d def\n", CurPage->xsize);
- X printf("/MinX 36 def\n");
- X printf("/MinY 36 def\n");
- X printf("/MaxX %d def\n", x-36);
- X printf("/MaxY %d def\n", y-36);
- X printf("/Border %s def\n", BorderSize);
- X printf("%s setlinewidth\n", LineWidth);
- X
- X/* Check if smallfont is fixed pitch */
- X if (!NoSmallCal) {
- X printf("SmallFont findfont /FontInfo get /isFixedPitch get\n");
- X
- X/* Define SmallString used to set smallfont size */
- X printf("{/SmallString (WW ) def}\n");
- X printf("{/SmallString (WW) def}\nifelse\n");
- X }
- X printf("%%%%EndProlog\n");
- X/* Set the minimum box size */
- X
- X}
- X
- X/***************************************************************/
- X/* */
- X/* WriteCalEntry - write all entries for one day */
- X/* */
- X/***************************************************************/
- X#ifdef HAVE_PROTOS
- Xvoid WriteCalEntry(void)
- X#else
- Xvoid WriteCalEntry()
- X#endif
- X{
- X CalEntry *c = CurEntries;
- X CalEntry *d;
- X
- X/* Move to appropriate location */
- X printf("Border ytop %d xincr mul MinX add xincr\n", WkDayNum);
- X
- X/* Set up the text array */
- X printf("[\n");
- X
- X CurEntries = NULL;
- X
- X while(c) {
- X WriteOneEntry(c->entry);
- X free(c->entry);
- X d = c->next;
- X free(c);
- X c = d;
- X }
- X printf("]\n");
- X
- X/* Print the day number */
- X printf("(%d)\n", CurDay);
- X/* Do it! */
- X printf("DoCalBox\n");
- X
- X/* Update ymin */
- X printf("/y exch def y ymin lt {/ymin y def} if\n");
- X
- X/* If WkDayNum is a Sunday, move to next row. */
- X if (WkDayNum == 6 || CurDay == MaxDay) {
- X printf("/y ytop MinBoxSize sub def y ymin lt {/ymin y def} if\n");
- X
- X/* Draw the line at the bottom of the row */
- X printf("MinX ymin MaxX ymin L\n");
- X
- X/* Update ytop */
- X printf("/ylast ytop def\n");
- X printf("/ytop ymin def\n");
- X }
- X}
- X
- X/***************************************************************/
- X/* */
- X/* WriteOneEntry - write an entry for one day */
- X/* */
- X/***************************************************************/
- X#ifdef HAVE_PROTOS
- Xvoid WriteOneEntry(char *s)
- X#else
- Xvoid WriteOneEntry(s)
- Xchar *s;
- X#endif
- X{
- X int c;
- X printf(" [");
- X
- X/* Chew up leading spaces */
- X while(isspace(*s)) s++;
- X
- X putchar('(');
- X while(*s) {
- X c = *s++;
- X if (c == '\\' || c == '(' || c == ')') putchar('\\');
- X if (!isspace(c)) putchar(c);
- X else {
- X putchar(')');
- X while(isspace(*s)) s++;
- X if (!*s) {
- X printf("]\n");
- X return;
- X }
- X putchar('(');
- X }
- X }
- X printf(")]\n");
- X}
- X
- X/***************************************************************/
- X/* */
- X/* Init - set up parameters */
- X/* */
- X/***************************************************************/
- X#ifdef HAVE_PROTOS
- XPUBLIC void Init(int argc, char *argv[])
- X#else
- Xvoid Init(argc, argv)
- Xint argc;
- Xchar *argv[];
- X#endif
- X{
- X char *s, *t;
- X int i=1;
- X int j;
- X
- X PortraitMode = 1;
- X NoSmallCal = 0;
- X
- X CurPage = Pages; /* Letter size by default */
- X
- X while (i < argc) {
- X s = argv[i];
- X i++;
- X
- X if (*s++ != '-') Usage("Options must begin with '-'");
- X
- X switch(*s++) {
- X case 's':
- X if (i == argc) Usage("Size must be supplied");
- X t = argv[i++];
- X while(*s) {
- X switch(*s++) {
- X case 'h': HeadSize = t; break;
- X case 'e': EntrySize = t; break;
- X case 'd': DaySize = t; break;
- X default: Usage("Size must specify h, e, or d");
- X }
- X }
- X break;
- X
- X case 'f':
- X if (i == argc) Usage("Font must be supplied");
- X t = argv[i++];
- X while(*s) {
- X switch(*s++) {
- X case 'h': HeadFont = t; break;
- X case 'e': EntryFont = t; break;
- X case 'd': DayFont = t; break;
- X case 's': SmallFont = t; break;
- X default: Usage("Font must specify s, h, e, or d");
- X }
- X }
- X break;
- X
- X case 'm':
- X if (i == argc) Usage("Media must be supplied");
- X t = argv[i++];
- X CurPage = NULL;
- X for (j=0; j<NUMPAGES; j++)
- X if (!strcmp(t, Pages[j].name)) {
- X CurPage = &Pages[j];
- X break;
- X }
- X
- X if (!CurPage) {
- X fprintf(stderr, "\nUnknown media specified.\n");
- X fprintf(stderr, "\nAvailable media types:\n");
- X for (j=0; j<NUMPAGES; j++)
- X fprintf(stderr, " %s\n", Pages[j].name);
- X exit(1);
- X }
- X break;
- X
- X case 'b':
- X if (i == argc) Usage("Border must be supplied");
- X BorderSize = argv[i++];
- X break;
- X
- X case 't':
- X if (i == argc) Usage("Line thickness must be supplied");
- X LineWidth = argv[i++];
- X break;
- X
- X case 'l': PortraitMode = 0; break;
- X
- X case 'c': NoSmallCal = 1; break;
- X
- X default: Usage("Unrecognized option");
- X }
- X }
- X}
- X
- X/***************************************************************/
- X/* */
- X/* Usage - print usage information */
- X/* */
- X/***************************************************************/
- X#ifdef HAVE_PROTOS
- XPUBLIC void Usage(char *s)
- X#else
- Xvoid Usage(s)
- Xchar *s;
- X#endif
- X{
- X if (s) fprintf(stderr, "\nrem2ps: %s\n\n", s);
- X
- X fprintf(stderr, "Rem2PS: Produce a PostScript calendar from output of Remind.\n\n");
- X fprintf(stderr, "Usage: rem2ps [options]\n\n");
- X fprintf(stderr, "Options:\n\n");
- X fprintf(stderr, "-l Do calendar in landscape mode.\n");
- X fprintf(stderr, "-c Do NOT generate small calendars for previous\n");
- X fprintf(stderr, " and next month.\n");
- X fprintf(stderr, "-m media Set page size (eg, Letter, Legal, A4.) Case sensitive!\n");
- X fprintf(stderr, "-f[shed] font Set font for small cal, hdr, cal entries and/or day numbers.\n");
- X fprintf(stderr, "-s[hed] size Set size for header, calendar entries and/or day numbers.\n");
- X fprintf(stderr, "-b size Set border size for calendar entries.\n");
- X fprintf(stderr, "-t size Set line thickness.\n");
- X exit(1);
- X}
- X
- X/***************************************************************/
- X/* */
- X/* DoSmallCal - do the small calendar for previous or next */
- X/* month. */
- X/* */
- X/***************************************************************/
- X#ifdef HAVE_PROTOS
- Xvoid DoSmallCal(char *m, int days, int first, int col)
- X#else
- Xvoid DoSmallCal(m, days, first, col)
- Xchar *m;
- Xint days, first, col;
- X#endif
- X{
- X /* Do the small calendar */
- X int i;
- X int row = 2;
- X
- X /* Figure out the font size */
- X
- X printf("/SmallFontSize MinBoxSize Border sub Border sub 8 div 2 sub def\n");
- X printf("SmallFont findfont setfont\n");
- X printf("SmallString stringwidth pop /SmallWidth exch def\n");
- X printf("SmallWidth 7 mul xincr Border sub Border sub exch div /tmp exch def\n");
- X printf("tmp SmallFontSize lt {/SmallFontSize tmp def} if\n");
- X printf("SmallFont findfont SmallFontSize scalefont setfont\n");
- X
- X /* Recalculate SmallWidth */
- X printf("SmallString stringwidth pop /SmallWidth exch def\n");
- X
- X /* Save graphics state */
- X printf("gsave\n");
- X
- X /* Move origin to upper-left hand corner of appropriate box */
- X printf("%d xincr mul MinX add ysmall translate\n", col);
- X
- X /* Print the month */
- X printf("SmallWidth 7 mul (%s) stringwidth pop sub 2 div Border add Border neg SmallFontSize sub moveto (%s) show\n", m, m);
- X
- X /* Print the days of the week */
- X for (i=0; i<7; i++)
- X printf("Border %d SmallWidth mul add Border neg SmallFontSize sub SmallFontSize sub 2 sub moveto (%c) show\n", i, Days[i]);
- X
- X /* Now do the days of the month */
- X for (i=1; i<=days; i++) {
- X printf("Border %d SmallWidth mul add Border neg SmallFontSize sub SmallFontSize 2 add %d mul sub moveto (%d) show\n", first, row, i);
- X first++;
- X if (first == 7) { first = 0; row++; }
- X }
- X
- X /* restore graphics state */
- X printf("grestore\n");
- X}
- X
- END_OF_FILE
- if test 16502 -ne `wc -c <'rem2ps.c'`; then
- echo shar: \"'rem2ps.c'\" unpacked with wrong size!
- fi
- # end of 'rem2ps.c'
- fi
- if test -f 'remind.def' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'remind.def'\"
- else
- echo shar: Extracting \"'remind.def'\" \(27 characters\)
- sed "s/^X//" >'remind.def' <<'END_OF_FILE'
- XNAME WINDOWCOMPAT NEWFILES
- END_OF_FILE
- if test 27 -ne `wc -c <'remind.def'`; then
- echo shar: \"'remind.def'\" unpacked with wrong size!
- fi
- # end of 'remind.def'
- fi
- echo shar: End of archive 1 \(of 2\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked both archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-