From f908c5395c24da621e5e30814a7a3e4fb76abcbc Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Tue, 20 Mar 2018 14:44:54 +0100 Subject: utils: Use 'scandir' instead of custom 'for-each-file' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/mcron/utils.scm (for-each-file): Delete. * src/mcron/scripts/cron.scm (process-files-in-system-directory): Use 'scandir' which has the benefit of being deterministic. * src/mcron/scripts/mcron.scm (process-files-in-user-directory): Likewise. * tests/schedule.sh: Update expected output which is now more reliable. * NEWS: Update. Suggested-by: Ludovic Courtès --- src/mcron/utils.scm | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'src/mcron/utils.scm') diff --git a/src/mcron/utils.scm b/src/mcron/utils.scm index 062e756..bb23f4a 100644 --- a/src/mcron/utils.scm +++ b/src/mcron/utils.scm @@ -1,6 +1,6 @@ ;;;; utils.scm -- helper procedures ;;; Copyright © 2003, 2012 Dale Mellor -;;; Copyright © 2015, 2016 Mathieu Lirzin +;;; Copyright © 2015, 2016, 2018 Mathieu Lirzin ;;; ;;; This file is part of GNU Mcron. ;;; @@ -29,7 +29,6 @@ parse-args show-version show-package-information - for-each-file process-update-request) #:re-export (option-ref read-string)) @@ -81,18 +80,6 @@ General help using GNU software: \n" config-package-name config-package-url)) -(define (for-each-file proc directory) - "Apply PROC to each file in DIRECTORY. DIRECTORY must be a valid directory name. -PROC must be a procedure that take one file name argument. The return value -is not specified" - (let ((dir (opendir directory))) - (let loop ((file-name (readdir dir))) - (if (eof-object? file-name) - (closedir dir) - (begin - (proc file-name) - (loop (readdir dir))))))) - (define (process-update-request fdes-list) "Read a user name from the socket, dealing with the /etc/crontab special case, remove all the user's jobs from the job list, and then re-read the -- cgit v1.2.3