Function: nndiary-parse-schedule-value

nndiary-parse-schedule-value is a byte-compiled function defined in nndiary.el.gz.

Signature

(nndiary-parse-schedule-value STR MIN-OR-VALUES MAX)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nndiary.el.gz
(defun nndiary-parse-schedule-value (str min-or-values max)
  ;; Parse the schedule string STR, or signal an error.
  ;; Signals are caught by `nndiary-schedule'.
  (if (string-match "[ \t]*\\*[ \t]*" str)
      ;; unspecified
      nil
    ;; specified
    (if (listp min-or-values)
	;; min-or-values is values
	;; #### NOTE: this is actually only a hack for time zones.
	(let ((val (and (string-match "[ \t]*\\([^ \t]+\\)[ \t]*" str)
			(match-string 1 str))))
	  (if (and val (setq val (assoc val min-or-values)))
	      (list (cadr val))
	    (error "Invalid syntax")))
      ;; min-or-values is min
      (mapcar
       (lambda (val)
	 (let ((res (split-string val "-")))
	   (cond
	    ((= (length res) 1)
	     (nndiary-string-to-number (car res) min-or-values max))
	    ((= (length res) 2)
	     ;; don't know if crontab accepts this, but ensure
	     ;; that BEG is <= END
	     (let ((beg (nndiary-string-to-number (car res) min-or-values max))
		   (end (nndiary-string-to-number (cadr res) min-or-values max)))
	       (cond ((< beg end)
		      (cons beg end))
		     ((= beg end)
		      beg)
		     (t
		      (cons end beg)))))
	    (t
	     (error "Invalid syntax")))
	   ))
       (split-string str ",")))
    ))