mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-11 08:21:13 +01:00
07b6256d8e
add errflag test to loop over fcntl()
30 lines
709 B
Text
30 lines
709 B
Text
local editor=${VISUAL:-${EDITOR:-vi}}
|
|
local line calendar
|
|
local -a lockfiles
|
|
|
|
integer cal_running
|
|
|
|
sched | while read line; do
|
|
[[ $line = *" calendar -s "<->" "<-> ]] && (( cal_running = 1 ))
|
|
done
|
|
|
|
zstyle -s ':datetime:calendar:' calendar-file calendar || calendar=~/calendar
|
|
|
|
# start of subshell for OS file locking
|
|
(
|
|
# start of block for following always to clear up lockfiles.
|
|
# Not needed but harmless if OS file locking is used.
|
|
{
|
|
if zmodload -F zsh/system b:zsystem && zsystem supports flock; then
|
|
zsystem flock $calendar
|
|
else
|
|
calendar_lockfiles $calendar || exit 1
|
|
fi
|
|
|
|
eval $editor \$calendar
|
|
} always {
|
|
(( ${#lockfiles} )) && rm -f $lockfiles
|
|
}
|
|
)
|
|
|
|
(( cal_running )) && calendar -s
|