AboutSummaryRefsLogTreeCommitDiffStats
diff options
context:
space:
mode:
authorDale Mellor <dale@rdmp.org>2014-04-28 11:47:55 +0100
committerDale Mellor <dale@rdmp.org>2014-04-28 13:03:28 +0100
commitc45e7c447bf1d95247225d1c70e0ce593cba2ddf (patch)
treebfef67d482ed783a8608bad7aec689109ef03942
parentbd5a58ac2fc1fa435a499c0dd8e6f779e68551c0 (diff)
downloadmcron-1.0.7.tar.gz
mcron-1.0.7.tar.bz2
mcron-1.0.7.zip
Now runs (only) against guile-2.0.1.0.7
-rw-r--r--.gitignore3
-rw-r--r--ChangeLog5
-rw-r--r--README4
-rw-r--r--README--git12
-rw-r--r--TODO4
-rw-r--r--configure.ac21
-rw-r--r--crontab.scm138
-rw-r--r--main.scm2
-rw-r--r--makefile.am8
-rw-r--r--mcron.150
-rw-r--r--mcron.c.template10
-rw-r--r--mcron.texinfo.in2
12 files changed, 104 insertions, 155 deletions
diff --git a/.gitignore b/.gitignore
index e760631..f8096eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
INSTALL
aclocal.m4
autom4te.cache
+compile
config.log
config.scm
config.status
@@ -15,7 +16,7 @@ makefile.in
mcron
mcron.c
mcron.info
-mcron.o
+*.o
mcron.texinfo
missing
texinfo.tex
diff --git a/ChangeLog b/ChangeLog
index 3978ec4..c604b83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-04-28 Dale Mellor <dale_mellor@users.sourceforge.net>
+
+ * We now run against, and require, guile-2.0.
+
+
2012-02-04 Dale Mellor <dale_mellor@users.sourceforge.net>
* main.scm: added search for initial files in
diff --git a/README b/README
index d4f7b6a..9f4f625 100644
--- a/README
+++ b/README
@@ -1,13 +1,13 @@
GNU mcron --- README -*-text-*-
- Copyright (C) 2003, 2005, 2006, 2012 Dale Mellor
+ Copyright (C) 2003, 2005, 2006, 2012, 2014 Dale Mellor
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
-This is version 1.0.7 of the GNU mcron program. It is designed and written by
+This is version 1.0.8 of the GNU mcron program. It is designed and written by
Dale Mellor, and replaces and hugely enhances Vixie cron. It is functionally
complete, production quality code (did you expect less?), but has not received
much testing yet. It has only been built on a GNU/Linux system, and will most
diff --git a/README--git b/README--git
index 14d5717..43e9890 100644
--- a/README--git
+++ b/README--git
@@ -1,6 +1,6 @@
GNU mcron --- README--git -*-text-*-
- Copyright (C) 2012 Dale Mellor
+ Copyright (C) 2012, 2014 Dale Mellor
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@@ -10,11 +10,11 @@ GNU mcron --- README--git -*-text-*-
If you have pulled mcron from the GIT repository, these are the steps you will
need to take to build it the first time:
-1) cp mcron.texinfo.in mcron.texinfo
-2) aclocal
-4) autoconf
-3) automake -a
-5) rm mcron.texinfo
+1) aclocal
+2) autoconf
+3) automake -a (will error)
+4) ./configure (will error)
+5) automake -a
6) ./configure --prefix={wherever}
7) make install
diff --git a/TODO b/TODO
index e8593aa..9ed8bca 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
GNU mcron --- TODO -*-text-*-
- Copyright (C) 2003, 2005, 2006 Dale Mellor
+ Copyright (C) 2003, 2005, 2006, 2014 Dale Mellor
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
@@ -45,4 +45,4 @@ May happen if version 2.0 ever materializes...
* TCP socket to allow control via HTTP (web browser interface). Or maybe
crontab-like CGI personality.
- * GTK+/Bononbo/Gnome2 interface.
+ * GTK+/d-bus/Gnome3 interface.
diff --git a/configure.ac b/configure.ac
index 6be28a4..0ffd581 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
-# Copyright (C) 2003, 2005, 2012 Dale Mellor
+# Copyright (C) 2003, 2005, 2012, 2014 Dale Mellor
#
# This file is part of GNU mcron.
#
@@ -42,11 +42,9 @@ AC_SUBST(CONFIG_DEBUG)
AC_PROG_AWK
AC_PROG_EGREP
-AC_PROG_CC
-GUILE_PROGS
-GUILE_FLAGS
-GUILE_SITE_DIR
+AM_PROG_CC_C_O
+PKG_CHECK_MODULES(GUILE, guile-2.0 >= 2.0.7)
# Checks for programs.
@@ -72,17 +70,6 @@ if test "x$ac_cv_prog_CP" = "x"; then
fi
-# Check the Guile version.
-
-AC_MSG_CHECKING(for guile version >= 1.8.0)
-if [$GUILE --version | $HEAD -1 | $AWK '{print $2}' | \
- $EGREP -q '^1\.8\.']; then
- AC_MSG_RESULT(OK)
-else
- AC_MSG_ERROR([Sorry, Guile 1.8.0 or greater is needed to run mcron])
-fi
-
-
# Now find a sendmail or equivalent.
AC_CHECK_PROGS(SENDMAIL, sendmail)
@@ -182,5 +169,5 @@ real_program_prefix=`echo $program_prefix | sed s/NONE//`
AC_SUBST(real_program_prefix)
-AC_CONFIG_FILES(makefile config.scm mcron.texinfo)
+AC_CONFIG_FILES(mcron.texinfo makefile config.scm)
AC_OUTPUT
diff --git a/crontab.scm b/crontab.scm
index ff74947..30e5592 100644
--- a/crontab.scm
+++ b/crontab.scm
@@ -1,4 +1,4 @@
-;; Copyright (C) 2003 Dale Mellor
+;; Copyright (C) 2003, 2014 Dale Mellor
;;
;; This file is part of GNU mcron.
;;
@@ -27,14 +27,15 @@
;; Procedure to communicate with running cron daemon that a user has modified
;; his crontab. The user name is written to the /var/cron/socket UNIX socket.
-(define (hit-server user-name)
- (catch #t (lambda ()
- (let ((socket (socket AF_UNIX SOCK_STREAM 0)))
- (connect socket AF_UNIX config-socket-file)
- (display user-name socket)
- (close socket)))
- (lambda (key . args)
- (display "Warning: a cron daemon is not running.\n"))))
+(let ((hit-server
+ (lambda (user-name)
+ (catch #t (lambda ()
+ (let ((socket (socket AF_UNIX SOCK_STREAM 0)))
+ (connect socket AF_UNIX config-socket-file)
+ (display user-name socket)
+ (close socket)))
+ (lambda (key . args)
+ (display "Warning: a cron daemon is not running.\n")))))
@@ -42,89 +43,95 @@
;; /var/cron/allow and /var/cron/deny), and determine if the given name is in
;; there. The procedure returns #t, #f, or '() if the file does not exist.
-(define (in-access-file? file name)
- (catch #t (lambda ()
- (with-input-from-file file (lambda ()
- (let loop ((input (read-line)))
- (if (eof-object? input)
- #f
- (if (string=? input name)
- #t
- (loop (read-line))))))))
- (lambda (key . args) '())))
-
-
+ (in-access-file?
+ (lambda (file name)
+ (catch #t (lambda ()
+ (with-input-from-file
+ file
+ (lambda ()
+ (let loop ((input (read-line)))
+ (if (eof-object? input)
+ #f
+ (if (string=? input name)
+ #t
+ (loop (read-line))))))))
+ (lambda (key . args) '()))))
+
+
-;; This program should have been installed SUID root. Here we get the passwd
-;; entry for the real user who is running this program.
+ ;; This program should have been installed SUID root. Here we get the
+ ;; passwd entry for the real user who is running this program.
-(define crontab-real-user (passwd:name (getpw (getuid))))
+ (crontab-real-user (passwd:name (getpw (getuid)))))
-;; If the real user is not allowed to use crontab due to the /var/cron/allow
-;; and/or /var/cron/deny files, bomb out now.
+ ;; If the real user is not allowed to use crontab due to the /var/cron/allow
+ ;; and/or /var/cron/deny files, bomb out now.
-(if (or (eq? (in-access-file? config-allow-file crontab-real-user) #f)
- (eq? (in-access-file? config-deny-file crontab-real-user) #t))
- (mcron-error 6 "Access denied by system operator."))
+ (if (or (eq? (in-access-file? config-allow-file crontab-real-user) #f)
+ (eq? (in-access-file? config-deny-file crontab-real-user) #t))
+ (mcron-error 6 "Access denied by system operator."))
+
+ ;; Check that no more than one of the mutually exclusive options are being
+ ;; used.
-;; Check that no more than one of the mutually exclusive options are being used.
+ (if (> (+ (if (option-ref options 'edit #f) 1 0)
+ (if (option-ref options 'list #f) 1 0)
+ (if (option-ref options 'remove #f) 1 0))
+ 1)
+ (mcron-error 7 "Only one of options -e, -l or -r can be used."))
-(if (> (+ (if (option-ref options 'edit #f) 1 0)
- (if (option-ref options 'list #f) 1 0)
- (if (option-ref options 'remove #f) 1 0))
- 1)
- (mcron-error 7 "Only one of options -e, -l or -r can be used."))
+ ;; Check that a non-root user is trying to read someone else's files.
-;; Check that a non-root user is trying to read someone else's files.
+ (if (and (not (eqv? (getuid) 0))
+ (option-ref options 'user #f))
+ (mcron-error 8 "Only root can use the -u option."))
-(if (and (not (eqv? (getuid) 0))
- (option-ref options 'user #f))
- (mcron-error 8 "Only root can use the -u option."))
+ (let (
-;; Iff the --user option is given, the crontab-user may be different from the
-;; real user.
+
+ ;; Iff the --user option is given, the crontab-user may be different
+ ;; from the real user.
-(define crontab-user (option-ref options 'user crontab-real-user))
+ (crontab-user (option-ref options 'user crontab-real-user))
+ ;; So now we know which crontab file we will be manipulating.
+
+ (crontab-file (string-append config-spool-dir "/" crontab-user))
-;; So now we know which crontab file we will be manipulating.
-(define crontab-file (string-append config-spool-dir "/" crontab-user))
+ ;; Display the prompt and wait for user to type his choice. Return #t if
+ ;; the answer begins with 'y' or 'Y', return #f if it begins with 'n' or
+ ;; 'N', otherwise ask again.
+ (get-yes-no (lambda (prompt . re-prompt)
+ (if (not (null? re-prompt))
+ (display "Please answer y or n.\n"))
+ (display (string-append prompt " "))
+ (let ((r (read-line)))
+ (if (not (string-null? r))
+ (case (string-ref r 0)
+ ((#\y #\Y) #t)
+ ((#\n #\N) #f)
+ (else (get-yes-no prompt #t)))
+ (get-yes-no prompt #t))))))
-;; Display the prompt and wait for user to type his choice. Return #t if the
-;; answer begins with 'y' or 'Y', return #f if it begins with 'n' or 'N',
-;; otherwise ask again.
-(define (get-yes-no prompt . re-prompt)
- (if (not (null? re-prompt))
- (display "Please answer y or n.\n"))
- (display (string-append prompt " "))
- (let ((r (read-line)))
- (if (not (string-null? r))
- (case (string-ref r 0)
- ((#\y #\Y) #t)
- ((#\n #\N) #f)
- (else (get-yes-no prompt #t)))
- (get-yes-no prompt #t))))
+ ;; There are four possible sub-personalities to the crontab personality:
+ ;; list, remove, edit and replace (when the user uses no options but
+ ;; supplies file names on the command line).
-
-;; There are four possible sub-personalities to the crontab personality: list,
-;; remove, edit and replace (when the user uses no options but supplies file
-;; names on the command line).
-
-(cond
+ (cond
;; In the list personality, we simply open the crontab and copy it
@@ -216,3 +223,6 @@
(else
(mcron-error 15 "usage error: file name must be specified for replace.")))
+
+
+)) ;; End of file-level let-scopes.
diff --git a/main.scm b/main.scm
index 2c6738e..36adef9 100644
--- a/main.scm
+++ b/main.scm
@@ -131,7 +131,7 @@
" command-name " (" config-package-string ")\n
Written by Dale Mellor\n
\n
-Copyright (C) 2003, 2006 Dale Mellor\n
+Copyright (C) 2003, 2006, 2014 Dale Mellor\n
This is free software; see the source for copying conditions. There is NO\n
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n
"))
diff --git a/makefile.am b/makefile.am
index 9d19014..85610df 100644
--- a/makefile.am
+++ b/makefile.am
@@ -31,15 +31,14 @@ EXTRA_DIST = makefile.ed main.scm mcron-core.scm vixie-specification.scm \
crontab.scm environment.scm job-specifier.scm redirect.scm \
vixie-time.scm mcron.c.template BUGS
-AM_LDFLAGS = @GUILE_LDFLAGS@
-AM_CFLAGS = @GUILE_CFLAGS@ -DGUILE_LOAD_PATH=\"$(datadir)\"
-
info_TEXINFOS = mcron.texinfo
dist_man1_MANS = mcron.1
bin_PROGRAMS = mcron
mcron_SOURCES = mcron.c
+mcron_LDADD = @GUILE_LIBS@
+mcron_CFLAGS = @GUILE_CFLAGS@ -DGUILE_LOAD_PATH=\"$(datadir)\"
pkgdata_DATA = core.scm environment.scm job-specifier.scm redirect.scm \
vixie-time.scm vixie-specification.scm config.scm
@@ -49,9 +48,6 @@ pkgdata_DATA = core.scm environment.scm job-specifier.scm redirect.scm \
# like core.*, so we have to keep re-making it (I lost a good day's work because
# of this).
-mcron : mcron.c
- $(CC) $(AM_CFLAGS) mcron.c -o mcron $(AM_LDFLAGS)
-
core.scm : mcron-core.scm
$(CP) mcron-core.scm core.scm
diff --git a/mcron.1 b/mcron.1
index ad0f7fc..e69de29 100644
--- a/mcron.1
+++ b/mcron.1
@@ -1,50 +0,0 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4.
-.TH MCRON "1" "February 2012" "mcron " "User Commands"
-.SH NAME
-mcron \- a program to run tasks at regular (or not) intervals
-.SH SYNOPSIS
-.B mcron
-[\fIOPTIONS\fR] [\fIFILES\fR]
-.SH DESCRIPTION
-Run an mcron process according to the specifications in the FILES (`\-' for
-standard input), or use all the files in ~/.config/cron (or the
-deprecated ~/.cron) with .guile or .vixie extensions.
-.TP
-\fB\-v\fR, \fB\-\-version\fR
-Display version
-.TP
-\fB\-h\fR, \fB\-\-help\fR
-Display this help message
-.TP
-\fB\-sN\fR, \fB\-\-schedule[\fR=\fI]N\fR
-Display the next N jobs that will be run by mcron
-.TP
-\fB\-d\fR, \fB\-\-daemon\fR
-Immediately detach the program from the terminal
-and run as a daemon process
-.TP
-\fB\-i\fR, \fB\-\-stdin=\fR(guile|vixie) Format of data passed as standard input or
-file arguments (default guile)
-.SH AUTHOR
-Written by Dale Mellor
-.SH "REPORTING BUGS"
-Report bugs to dale_mellor@users.sourceforge.net.
-.PP
-mcron (mcron 1.0.7)
-.SH COPYRIGHT
-Copyright \(co 2003, 2006 Dale Mellor
-.br
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-.SH "SEE ALSO"
-The full documentation for
-.B mcron
-is maintained as a Texinfo manual. If the
-.B info
-and
-.B mcron
-programs are properly installed at your site, the command
-.IP
-.B info mcron
-.PP
-should give you access to the complete manual.
diff --git a/mcron.c.template b/mcron.c.template
index cba503e..e9a755d 100644
--- a/mcron.c.template
+++ b/mcron.c.template
@@ -1,6 +1,6 @@
/* -*-c-*- */
/*
- * Copyright (C) 2003 Dale Mellor
+ * Copyright (C) 2003, 2014 Dale Mellor
*
* This file is part of GNU mcron.
*
@@ -66,7 +66,7 @@
void
react_to_terminal_signal (int sig)
{
- scm_eval_string (scm_take0str ("(delete-run-file)") );
+ scm_c_eval_string ("(delete-run-file)");
exit (1);
}
@@ -100,9 +100,9 @@ inner_main ()
{
scm_c_define_gsubr ("c-set-cron-signals", 0, 0, 0, set_cron_signals);
- scm_eval_string (scm_take0str (
- GUILE_PROGRAM_GOES_HERE
- ) );
+ scm_c_eval_string (
+ GUILE_PROGRAM_GOES_HERE
+ );
}
diff --git a/mcron.texinfo.in b/mcron.texinfo.in
index 4f9f855..bbf8e5b 100644
--- a/mcron.texinfo.in
+++ b/mcron.texinfo.in
@@ -9,7 +9,7 @@
@copying This manual is for GNU mcron (version @VERSION@), which is a
program for running jobs at scheduled times.
-Copyright @copyright{} 2003, 2005, 2006, 2012 Dale Mellor
+Copyright @copyright{} 2003, 2005, 2006, 2012, 2014 Dale Mellor
@quotation
Permission is granted to copy, distribute and/or modify this