1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#! /bin/sh /usr/share/dpatch/dpatch-run
## 01-optional-filename.dpatch by Ren� van Bevern <rvb@pro-linux.de>
##
## DP: make the filename argument optional. If no filename is given, use
## DP: ~/.reminders or $DOT_REMINDERS as reminder file. This obsoletes the "rem"
## DP: script which lead to problems in the past. Read bug #310818 and
## DP: README.Debian for details.
@DPATCH@
diff -urNad remind-03.00.23/man/remind.1 /tmp/dpep.W6kDPi/remind-03.00.23/man/remind.1
--- remind-03.00.23/man/remind.1 2005-05-26 20:06:36.000000000 +0200
+++ /tmp/dpep.W6kDPi/remind-03.00.23/man/remind.1 2005-05-26 20:06:41.000000000 +0200
@@ -4,7 +4,7 @@
.SH NAME
remind \- a sophisticated reminder service
.SH SYNOPSIS
-.B remind [\fIoptions\fR] \fIfilename\fR [\fIdate\fR] [\fI*rep\fR] [\fItime\fR]
+.B remind [\fIoptions\fR] [\fIfilename\fR [\fIdate\fR] [\fI*rep\fR] [\fItime\fR] ]
.SH DESCRIPTION
\fBRemind\fR reads the supplied \fIfilename\fR and executes the commands
found in it. The commands are used to issue reminders and alarms. Each
@@ -13,7 +13,9 @@
.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.
+the \fB\-o\fR option, described below. If no filename is given, remind uses
+\fI~/.reminders\fR or the content of the DOT_REMINDERS environment
+variable.
.SH OPTIONS
\fBRemind\fR has a slew of options. If you're new to the program,
ignore them for now and skip to the section "Reminder Files".
diff -urNad remind-03.00.23/src/init.c /tmp/dpep.W6kDPi/remind-03.00.23/src/init.c
--- remind-03.00.23/src/init.c 2005-05-26 20:06:36.000000000 +0200
+++ /tmp/dpep.W6kDPi/remind-03.00.23/src/init.c 2005-05-26 20:07:30.000000000 +0200
@@ -47,6 +47,8 @@
#include "version.h"
#include "globals.h"
+#define DOT_REMINDERS ".reminders"
+
/***************************************************************
*
* Command line options recognized:
@@ -105,6 +107,30 @@
/***************************************************************/
/* */
+/* DefaultReminders */
+/* */
+/* Detect a default reminder file */
+/* */
+/***************************************************************/
+
+char* DefaultReminders()
+{
+ char *dot_reminders;
+ char *home;
+ size_t len;
+ if((dot_reminders=getenv("DOT_REMINDERS")))
+ return dot_reminders;
+ else if((home=getenv("HOME"))) {
+ len = strlen(home) + strlen(DOT_REMINDERS) + 2;
+ dot_reminders = (char*)malloc(len);
+ snprintf(dot_reminders, len, "%s/%s", home, DOT_REMINDERS);
+ return dot_reminders;
+ }
+ else return DOT_REMINDERS;
+}
+
+/***************************************************************/
+/* */
/* InitRemind */
/* */
/* Initialize the system - called only once at beginning! */
@@ -394,11 +420,8 @@
}
/* Get the filename. */
- if (i >= argc) {
- Usage();
- exit(1);
- }
- InitialFile = argv[i++];
+ if (i >= argc) InitialFile = DefaultReminders();
+ else InitialFile = argv[i++];
/* Get the date, if any */
if (i < argc) {
@@ -500,7 +523,7 @@
#ifdef BETA
fprintf(ErrFp, ">>>> BETA VERSION <<<<\n");
#endif
- fprintf(ErrFp, "Usage: remind [options] filename [date] [time] [*rep]\n");
+ fprintf(ErrFp, "Usage: remind [options] [filename [date] [time] [*rep] ]\n");
fprintf(ErrFp, "Options:\n");
fprintf(ErrFp, " -n Output next occurrence of reminders in simple format\n");
fprintf(ErrFp, " -r Disable RUN directives\n");
diff -urNad remind-03.00.23/src/protos.h /tmp/dpep.W6kDPi/remind-03.00.23/src/protos.h
--- remind-03.00.23/src/protos.h 2005-05-26 20:06:36.000000000 +0200
+++ /tmp/dpep.W6kDPi/remind-03.00.23/src/protos.h 2005-05-26 20:06:41.000000000 +0200
@@ -60,6 +60,7 @@
int SetAccessDate ARGS ((char *fname, int jul));
int TopLevel ARGS ((void));
int CallFunc ARGS ((Operator *f, int nargs));
+char* DefaultReminders ARGS ((void));
void InitRemind ARGS ((int argc, char *argv[]));
void Usage ARGS ((void));
int main ARGS ((int argc, char *argv[]));
|