Xinqi Bao's Git
projects
/
dmenu.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
adapted c99 for pedantic checks, even if those checks are somewhat broken
[dmenu.git]
/
dmenu_path
diff --git
a/dmenu_path
b/dmenu_path
index
e590a5c
..
d0a32c5
100755
(executable)
--- a/
dmenu_path
+++ b/
dmenu_path
@@
-1,22
+1,17
@@
#!/bin/sh
CACHE=$HOME/.dmenu_cache
#!/bin/sh
CACHE=$HOME/.dmenu_cache
-UPTODATE=1
IFS=:
IFS=:
-if test ! -f $CACHE
-then
- unset UPTODATE
-fi
-
-if test $UPTODATE
-then
+uptodate() {
+ test ! -f $CACHE && return 1
for dir in $PATH
do
for dir in $PATH
do
- test $dir -nt $CACHE &&
unset UPTODATE
+ test $dir -nt $CACHE &&
return 1
done
done
-fi
+ return 0
+}
-if
test ! $UPTODATE
+if
! uptodate
then
for dir in $PATH
do
then
for dir in $PATH
do
@@
-24,7
+19,8
@@
then
do
test -x "$file" && echo "${file##*/}"
done
do
test -x "$file" && echo "${file##*/}"
done
- done | sort | uniq > $CACHE
+ done | sort | uniq > $CACHE.$$
+ mv $CACHE.$$ $CACHE
fi
cat $CACHE
fi
cat $CACHE