Lines 132-137
Link Here
|
132 |
done |
132 |
done |
133 |
} |
133 |
} |
134 |
|
134 |
|
|
|
135 |
# @FUNCTION: estat |
136 |
# @USAGE: <'%a'> <file> |
137 |
# @DESCRIPTION: |
138 |
# Portable version of GNU stat -c. See GNU stat(1) manpage. |
139 |
# Its usage is limited to format specifiers that are actually implemented in a |
140 |
# portable way. |
141 |
# It supports only one format specifier, meaning "$(estat '%a%b' file)" is not |
142 |
# allowed but "$(estat '%a' file)$(estat '%b' file)" should be used instead. |
143 |
# estat currently implements the following specifiers from GNU stat: %a. |
144 |
estat() { |
145 |
local stat_version="unknown" |
146 |
if $(stat --help 2>&1 | grep -q GNU) ; then |
147 |
stat_version="GNU" |
148 |
fi |
149 |
|
150 |
local fmt=$1; shift |
151 |
|
152 |
case ${fmt} in |
153 |
%a) |
154 |
if [ "${stat_version}" = "GNU" ] ; then |
155 |
stat -c "${fmt}" "$@" |
156 |
else |
157 |
find "$@" -maxdepth 0 -printf '%m' |
158 |
fi;; |
159 |
*) die "unhandled form";; |
160 |
esac |
161 |
} |
162 |
|
135 |
_dead_portability_user_funcs() { die "if you really need this, please file a bug for base-system@gentoo.org"; } |
163 |
_dead_portability_user_funcs() { die "if you really need this, please file a bug for base-system@gentoo.org"; } |
136 |
is-login-disabled() { _dead_portability_user_funcs; } |
164 |
is-login-disabled() { _dead_portability_user_funcs; } |
137 |
|
165 |
|