| 1 |
#!/bin/sh |
| 2 |
# gpatch - GNU patch wrapper for Solaris /usr/bin/patch |
| 3 |
# - Converts -d<dir> to an explicit cd (Solaris patch ignores -d) |
| 4 |
# - Strips -F (fuzz factor, not supported) |
| 5 |
# - Passes -u explicitly so Solaris patch handles unified diffs |
| 6 |
DIR="" |
| 7 |
ARGS="-u" |
| 8 |
skip_next=0 |
| 9 |
for arg in "$@"; do |
| 10 |
if [ "$skip_next" = 1 ]; then |
| 11 |
DIR="$arg" |
| 12 |
skip_next=0 |
| 13 |
continue |
| 14 |
fi |
| 15 |
case "$arg" in |
| 16 |
-F*) ;; |
| 17 |
-u) ;; # already added |
| 18 |
-d) skip_next=1 ;; |
| 19 |
-d*) DIR="${arg#-d}" ;; |
| 20 |
*) ARGS="$ARGS $arg" ;; |
| 21 |
esac |
| 22 |
done |
| 23 |
if [ -n "$DIR" ]; then |
| 24 |
cd "$DIR" || exit 1 |
| 25 |
fi |
| 26 |
exec /usr/bin/patch $ARGS |