This commit is contained in:
Jephté Clain 2024-06-21 20:33:50 +04:00
parent e4176dfd94
commit 21042e4677
1 changed files with 14 additions and 2 deletions

View File

@ -154,7 +154,7 @@ function ctmatch_one(ctval, ref, parts, part, i, j, start, end, ste
#print "final: is " ref " ~ " ctval " ? " (ok? "yes": "no") #DEBUG #print "final: is " ref " ~ " ctval " ? " (ok? "yes": "no") #DEBUG
return ok return ok
} }
function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow, Mok, Hok, domok, monok, dowok) { function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow, Mok, Hok, alldom, domok, monok, alldow, dowok, doxok) {
if (refM == "**ANY**") return 1 if (refM == "**ANY**") return 1
gsub(/\*/, "0-59", M) gsub(/\*/, "0-59", M)
@ -163,16 +163,28 @@ function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow,
gsub(/\*/, "0-23", H) gsub(/\*/, "0-23", H)
Hok = ctmatch_one(H, refH) Hok = ctmatch_one(H, refH)
alldom = dom == "*"
gsub(/\*/, "1-31", dom) gsub(/\*/, "1-31", dom)
domok = ctmatch_one(dom, refdom) domok = ctmatch_one(dom, refdom)
gsub(/\*/, "1-12", mon) gsub(/\*/, "1-12", mon)
monok = ctmatch_one(mon, refmon) monok = ctmatch_one(mon, refmon)
alldow = dow == "*"
gsub(/\*/, "1-7", dow) gsub(/\*/, "1-7", dow)
dowok = ctmatch_one(dow, refdow) dowok = ctmatch_one(dow, refdow)
return Mok && Hok && monok && (domok || dowok) if (alldom && alldow) {
doxok = 1
} else if (alldom) {
doxok = dowok
} else if (alldow) {
doxok = domok
} else {
doxok = domok || dowok
}
return Mok && Hok && monok && doxok
} }
function print_cmd(cmd) { function print_cmd(cmd) {
print "__ctexec " quote_value(cmd) print "__ctexec " quote_value(cmd)