mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-17 06:48:47 +02:00
Incorporate rem's functionality directly into Remind.
This commit is contained in:
@@ -20,8 +20,6 @@ AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
AC_PATH_PROG(PERL, perl)
|
||||
|
||||
dnl Checks for libraries.
|
||||
dnl Replace `main' with a function in -lm:
|
||||
|
||||
|
||||
16
man/rem.1
16
man/rem.1
@@ -3,16 +3,18 @@
|
||||
.SH NAME
|
||||
rem \- Invoke Remind with a default filename
|
||||
.SH SYNOPSIS
|
||||
.B rem [\fIoptions\fR]
|
||||
.B rem [\fIoptions\fR] [\fIdate\fR] [\fI*rep\fR] [\fItime\fR]
|
||||
.SH DESCRIPTION
|
||||
\fBrem\fR is a Perl script that invokes \fBremind\fR with the specified
|
||||
\fIoptions\fR, if any, and with a default filename.
|
||||
\fBrem\fR is a symbolic link to \fBremind\fR. When \fBremind\fR
|
||||
determines that it has been invoked as \fBrem\fR, it uses a default
|
||||
filename rather than expecting a filename to be supplied on the command
|
||||
line.
|
||||
.PP
|
||||
If the environment variable DOTREMINDERS is set, \fBremind\fR is invoked
|
||||
with DOTREMINDERS' value as the filename. Otherwise, \fBremind\fR is
|
||||
invoked with the filename $HOME/.reminders
|
||||
If the environment variable DOTREMINDERS is set, \fBremind\fR uses the
|
||||
value of DOTREMINDERS as the filename. Otherwise, \fBremind\fR uses
|
||||
the filename $HOME/.reminders
|
||||
.PP
|
||||
.SH AUTHOR
|
||||
Rem was written by David F. Skoll <dfs@roaringpenguin.com>
|
||||
Remind was written by David F. Skoll <dfs@roaringpenguin.com>
|
||||
.SH SEE ALSO
|
||||
\fBremind\fR
|
||||
|
||||
@@ -4043,4 +4043,4 @@ Catalog\fR, Jewish Publication Society of America.
|
||||
.PP
|
||||
.SH SEE ALSO
|
||||
.PP
|
||||
rem2ps, tkremind
|
||||
rem, rem2ps, tkremind
|
||||
|
||||
23
scripts/rem
23
scripts/rem
@@ -1,23 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
eval 'exec perl -S $0 ${1+"$@"}'
|
||||
if $running_under_some_shell;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $reminder_file = $ENV{'DOTREMINDERS'} || $ENV{'HOME'} . '/.reminders';
|
||||
|
||||
my @cmd;
|
||||
my $thing;
|
||||
push(@cmd, 'remind');
|
||||
while ($thing = shift(@ARGV)) {
|
||||
last unless ($thing =~ /^-/);
|
||||
push(@cmd, $thing);
|
||||
}
|
||||
push(@cmd, $reminder_file);
|
||||
push(@cmd, $thing) if (defined($thing) && ($thing ne ''));
|
||||
push(@cmd, @ARGV);
|
||||
|
||||
exec(@cmd);
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ INSTALL_DATA=@INSTALL_DATA@
|
||||
|
||||
PROGS= remind rem2ps
|
||||
SCRIPTS= $(srcdir)/../scripts/tkremind $(srcdir)/../scripts/cm2rem.tcl
|
||||
PERLSCRIPTS= rem
|
||||
|
||||
MANS= $(srcdir)/../man/rem2ps.1 $(srcdir)/../man/remind.1 \
|
||||
$(srcdir)/../man/tkremind.1 $(srcdir)/../man/cm2rem.1 \
|
||||
@@ -50,22 +49,22 @@ rem2ps: rem2ps.o dynbuf.o
|
||||
remind: $(REMINDOBJS)
|
||||
@CC@ @LDFLAGS@ $(LDEXTRA) -o remind $(REMINDOBJS) @LIBS@
|
||||
|
||||
install: all
|
||||
install-nostripped: all
|
||||
-mkdir -p $(DESTDIR)$(bindir) || true
|
||||
for prog in $(PROGS) $(SCRIPTS) ; do \
|
||||
$(INSTALL_PROGRAM) $$prog $(DESTDIR)$(bindir) || exit 1; \
|
||||
done
|
||||
for prog in $(PERLSCRIPTS) ; do \
|
||||
sed -e 's|#!/usr/bin/perl|#!@PERL@|' < $(srcdir)/../scripts/$$prog > $(DESTDIR)$(bindir)/$$prog || exit 1; \
|
||||
chmod 755 $(DESTDIR)$(bindir)/$$prog || exit 1; \
|
||||
done
|
||||
-strip $(DESTDIR)$(bindir)/remind || true
|
||||
-strip $(DESTDIR)$(bindir)/rem2ps || true
|
||||
rm -f $(DESTDIR)$(bindir)/rem > /dev/null 2>&1 || true
|
||||
ln -s remind $(DESTDIR)$(bindir)/rem
|
||||
-mkdir -p $(DESTDIR)$(mandir)/man1 || true
|
||||
for man in $(MANS) ; do \
|
||||
$(INSTALL_DATA) $$man $(DESTDIR)$(mandir)/man1 || exit 1; \
|
||||
done
|
||||
|
||||
install: install-nostripped
|
||||
strip $(DESTDIR)$(bindir)/remind || true
|
||||
strip $(DESTDIR)$(bindir)/rem2ps || true
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ core *.bak $(PROGS)
|
||||
|
||||
|
||||
58
src/init.c
58
src/init.c
@@ -84,6 +84,37 @@ static void InitializeVar(char *str);
|
||||
|
||||
static char *BadDate = "Illegal date on command line\n";
|
||||
|
||||
static DynamicBuffer default_filename_buf;
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* DefaultFilename */
|
||||
/* */
|
||||
/* If we're invoked as "rem" rather than "remind", use a */
|
||||
/* default filename. Use $DOTREMINDERS or $HOME/.reminders */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static char *DefaultFilename(void)
|
||||
{
|
||||
char *s;
|
||||
|
||||
DBufInit(&default_filename_buf);
|
||||
|
||||
s = getenv("DOTREMINDERS");
|
||||
if (s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
s = getenv("HOME");
|
||||
if (!s) {
|
||||
fprintf(stderr, "HOME environment variable not set. Unable to determine reminder file.\n");
|
||||
exit(1);
|
||||
}
|
||||
DBufPuts(&default_filename_buf, s);
|
||||
DBufPuts(&default_filename_buf, "/.reminders");
|
||||
return DBufValue(&default_filename_buf);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
/* */
|
||||
/* InitRemind */
|
||||
@@ -97,6 +128,8 @@ void InitRemind(int argc, char *argv[])
|
||||
int i;
|
||||
int y, m, d, rep;
|
||||
Token tok;
|
||||
int InvokedAsRem = 0;
|
||||
char *s;
|
||||
|
||||
/* Initialize global dynamic buffers */
|
||||
DBufInit(&Banner);
|
||||
@@ -125,6 +158,19 @@ void InitRemind(int argc, char *argv[])
|
||||
JulianToday = RealToday;
|
||||
FromJulian(JulianToday, &CurYear, &CurMon, &CurDay);
|
||||
|
||||
/* See if we were invoked as "rem" rather than "remind" */
|
||||
if (argv[0]) {
|
||||
s = strrchr(argv[0], '/');
|
||||
if (!s) {
|
||||
s = argv[0];
|
||||
} else {
|
||||
s++;
|
||||
}
|
||||
if (!strcmp(s, "rem")) {
|
||||
InvokedAsRem = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the command-line options */
|
||||
i = 1;
|
||||
while (i < argc) {
|
||||
@@ -360,11 +406,15 @@ void InitRemind(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* Get the filename. */
|
||||
if (i >= argc) {
|
||||
Usage();
|
||||
exit(1);
|
||||
if (!InvokedAsRem) {
|
||||
if (i >= argc) {
|
||||
Usage();
|
||||
exit(1);
|
||||
}
|
||||
InitialFile = argv[i++];
|
||||
} else {
|
||||
InitialFile = DefaultFilename();
|
||||
}
|
||||
InitialFile = argv[i++];
|
||||
|
||||
/* Get the date, if any */
|
||||
if (i < argc) {
|
||||
|
||||
Reference in New Issue
Block a user