diff options
author | Mathieu Lirzin <mthl@gnu.org> | 2018-03-27 01:58:08 +0200 |
---|---|---|
committer | Mathieu Lirzin <mthl@gnu.org> | 2018-03-27 03:29:47 +0200 |
commit | 729bae0c984021b6b0b18aecc76408bd52f9e6ad (patch) | |
tree | 6dd6faaab8ea1bc25627d4bb4412632d79d9b7e5 /src | |
parent | 8ab0465d92159cee9649210c9088641dd3ab4d6f (diff) | |
download | mcron-729bae0c984021b6b0b18aecc76408bd52f9e6ad.tar.gz mcron-729bae0c984021b6b0b18aecc76408bd52f9e6ad.tar.bz2 mcron-729bae0c984021b6b0b18aecc76408bd52f9e6ad.zip |
utils: Remove 'parse-args'
It seems that it is not useful to catch 'misc-error exception when
calling 'getopt-long'. Since 'parse-args' purpose was only to catch
this particular error, it can be deleted.
* src/mcron/utils.scm (parse-args): Remove.
Diffstat (limited to 'src')
-rw-r--r-- | src/mcron/scripts/cron.scm | 3 | ||||
-rw-r--r-- | src/mcron/scripts/crontab.scm | 3 | ||||
-rw-r--r-- | src/mcron/utils.scm | 12 |
3 files changed, 5 insertions, 13 deletions
diff --git a/src/mcron/scripts/cron.scm b/src/mcron/scripts/cron.scm index 323499e..1a97fdf 100644 --- a/src/mcron/scripts/cron.scm +++ b/src/mcron/scripts/cron.scm @@ -18,6 +18,7 @@ ;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>. (define-module (mcron scripts cron) + #:use-module (ice-9 getopt-long) #:use-module (ice-9 ftw) #:use-module (mcron base) #:use-module (mcron config) @@ -134,7 +135,7 @@ option.\n") ;;; (define* (main #:optional (args (command-line))) - (let ((opts (parse-args args %options))) + (let ((opts (getopt-long args %options))) (when config-debug (debug-enable 'backtrace)) (cond diff --git a/src/mcron/scripts/crontab.scm b/src/mcron/scripts/crontab.scm index abc3d7b..902d3fc 100644 --- a/src/mcron/scripts/crontab.scm +++ b/src/mcron/scripts/crontab.scm @@ -18,6 +18,7 @@ ;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>. (define-module (mcron scripts crontab) + #:use-module (ice-9 getopt-long) #:use-module (ice-9 rdelim) #:use-module (mcron config) #:use-module (mcron utils) @@ -78,7 +79,7 @@ USER-NAME has modified his crontab. USER-NAME is written to the ;;; (define* (main #:optional (args (command-line))) - (let ((opts (parse-args args %options))) + (let ((opts (getopt-long args %options))) (when config-debug (debug-enable 'backtrace)) (cond ((option-ref opts 'help #f) diff --git a/src/mcron/utils.scm b/src/mcron/utils.scm index da72ea5..00cf0c5 100644 --- a/src/mcron/utils.scm +++ b/src/mcron/utils.scm @@ -18,7 +18,6 @@ ;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>. (define-module (mcron utils) - #:use-module (ice-9 getopt-long) #:use-module (ice-9 rdelim) #:use-module (mcron config) #:use-module (mcron base) @@ -26,13 +25,11 @@ #:use-module (mcron vixie-specification) #:export (catch-mcron-error mcron-error - parse-args show-version show-package-information process-update-request get-user) - #:re-export (option-ref - read-string)) + #:re-export (read-string)) (define (mcron-error exit-code . rest) "Print an error message (made up from the parts of REST), and if the @@ -53,13 +50,6 @@ and exit with its error code." (lambda (key exit-code . msg) (apply mcron-error exit-code msg)))) -(define (parse-args args option-desc-list) - "Parse ARGS with OPTION-DESC-LIST specification." - (catch 'misc-error - (lambda () (getopt-long args option-desc-list)) - (lambda (key func fmt args . rest) - (mcron-error 1 (apply format (append (list #f fmt) args)))))) - (define (show-version command) "Display version information for COMMAND and quit." (let* ((name config-package-name) |