|
Line
Link Here
|
| 0 |
-- scripts/inspect.in |
0 |
++ scripts/inspect.in |
|
Lines 89-94
Link Here
|
| 89 |
cat <<-'EOF' > $tmpdir/bin/wrapper |
89 |
cat <<-'EOF' > $tmpdir/bin/wrapper |
| 90 |
#! @BASH@ |
90 |
#! @BASH@ |
| 91 |
|
91 |
|
|
|
92 |
# short options that take no arguments for "patch" |
| 93 |
s_opts='[bcefElnNrRsvVYZ]' |
| 94 |
|
| 92 |
# search the path for command $1 |
95 |
# search the path for command $1 |
| 93 |
path_search() { |
96 |
path_search() { |
| 94 |
local cmd=$1 dir |
97 |
local cmd=$1 dir |
|
Lines 143-161
Link Here
|
| 143 |
return 1 |
146 |
return 1 |
| 144 |
} |
147 |
} |
| 145 |
|
148 |
|
| 146 |
# Extract the -p option from the command line |
149 |
# Extract the -p|--strip= option from the command line |
| 147 |
strip_option() { |
150 |
strip_option() { |
| 148 |
while [ $# -ne 0 -a "${1:0:2}" != -p ] |
151 |
local opt_p |
|
|
152 |
while [ $# -ne 0 ] |
| 149 |
do |
153 |
do |
|
|
154 |
case "${1}" in |
| 155 |
-p*|-${s_opts}p*|-${s_opts}${s_opts}p*) |
| 156 |
opt_p="-p${1#-*p}" |
| 157 |
[ "$opt_p" = -p ] && { opt_p="$1$2"; shift; } |
| 158 |
;; |
| 159 |
--strip=*) |
| 160 |
opt_p="-p${1#--strip=}" |
| 161 |
;; |
| 162 |
esac |
| 150 |
shift |
163 |
shift |
| 151 |
done |
164 |
done |
| 152 |
if [ "${1:0:2}" = -p ] |
165 |
[ "$opt_p" -a "$opt_p" != -p1 ] && echo $opt_p |
| 153 |
then |
|
|
| 154 |
[ "$1" = -p ] && set -- "$1$2" |
| 155 |
[ "$1" != -p1 ] && echo $1 |
| 156 |
fi |
| 157 |
} |
166 |
} |
| 158 |
|
167 |
|
|
|
168 |
# parse -i|--input|--input= and redirect stdin from that file |
| 169 |
case "${0##*/}" in |
| 170 |
patch) |
| 171 |
OPTS=("$@") |
| 172 |
while [ "$1" ] |
| 173 |
do |
| 174 |
case "$1" in |
| 175 |
-i*|-${s_opts}i*|-${s_opts}${s_opts}i*) |
| 176 |
opt_i="-i${1#-*i}" |
| 177 |
if [ "$opt_i" = -i ] ; then |
| 178 |
exec <"$2" |
| 179 |
shift |
| 180 |
else |
| 181 |
exec <"${opt_i#-i}" |
| 182 |
fi |
| 183 |
unset opt_i |
| 184 |
shift ;; |
| 185 |
--input=*) |
| 186 |
exec <"${1#--input=}" |
| 187 |
shift ;; |
| 188 |
--input) |
| 189 |
exec <"${2}" |
| 190 |
shift 2 ;; |
| 191 |
*) |
| 192 |
shift ;; |
| 193 |
esac |
| 194 |
done |
| 195 |
set -- "${OPTS[@]}" |
| 196 |
;; |
| 197 |
esac |
| 198 |
|
| 159 |
# put data into tmpfile |
199 |
# put data into tmpfile |
| 160 |
tmpdir=${RPM_BUILD_DIR%/*} |
200 |
tmpdir=${RPM_BUILD_DIR%/*} |
| 161 |
cat > $tmpdir/data |
201 |
cat > $tmpdir/data |