cornucopia: bump SRCREV
[openembedded.git] / bin / darwin / sed
blobf52d09f0758429c2e9c89bcbee3330b806235e23
1 #!/bin/sh
3 # Sed portability notes
4 # - SuSv3
5 # - Only -e, -f, and -n are standard options
6 # - Linux
7 # - -i argument is of the form -i[ext]
8 # - extended regular expressions argument is -r
9 # - Mac OSX
10 # - -i argument is of the form -i [ext]
11 # - extended regular expressions argument is -E
13 # Here we support a limited subset of the available sed capabilities,
14 # ensuring that all those supported by this script can be utilized
15 # regardless of the current platform.
17 # We accept -n, -e, -f, and -i with no backup extension. We support
18 # extended regular expressions using the -r argument. Note that extended
19 # regular expressions support may not be retained, depending upon the
20 # capabilities of the other platforms we wish to support, and we may need
21 # to reimplement -i internally in this script on some platforms.
24 source $(dirname $0)/../wrapper.sh
26 case `uname -s` in
27 Darwin)
28 inplace_arg="-i ''"
29 extended_re_arg="-E"
30 getopt_os="ir"
32 Linux)
33 inplace_arg="-i"
34 extended_re_arg="-r"
35 getopt_os="ir"
37 esac
39 saved=""
40 while getopts ne:f:$getopt_os opt; do
41 case "$opt" in
43 save "-$opt"
45 e|f)
46 save "-$opt"
47 save "$OPTARG"
50 saved="$saved $inplace_arg"
53 saved="$saved $extended_re_arg"
55 \?)
56 exit 1
58 esac
59 done
60 shift $(($OPTIND - 1))
61 for arg; do
62 save "$arg"
63 done
65 exec_real