File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ function perform_test {
6060 # on the same line as the <unix-sys:name> element. Match the explicit name
6161 # tags so value payloads do not pollute the extracted key list.
6262 grep ' <unix-sys:name>' " $result " | \
63- xsed -E ' s;.*<unix-sys:name>([^<]+)</unix-sys:name>.*;\1;g' | \
63+ sed -E ' s;.*<unix-sys:name>([^<]+)</unix-sys:name>.*;\1;g' | \
6464 sort > " $ourNames "
6565
6666 echo " Diff (sysctlNames / ourNames): ------"
Original file line number Diff line number Diff line change @@ -339,7 +339,35 @@ make_temp_file() {
339339xsed () {
340340 case $( uname) in
341341 FreeBSD)
342- gsed " $@ "
342+ if command -v gsed > /dev/null 2>&1 ; then
343+ gsed " $@ "
344+ return
345+ fi
346+
347+ local inplace=0
348+ local arg
349+ local transformed=()
350+
351+ for arg in " $@ " ; do
352+ if [ " $arg " = " -i" ]; then
353+ inplace=1
354+ continue
355+ fi
356+
357+ # Translate the small subset of GNU sed escapes used by the test
358+ # suite so the fallback works with FreeBSD sed too.
359+ arg=${arg// \\ s/ [[:space:]]}
360+ arg=${arg// \\ S/ [^[:space:]]}
361+ arg=${arg// \\ w/ [[:alnum:]_]}
362+ arg=${arg// \\ W/ [^[:alnum:]_]}
363+ transformed+=(" $arg " )
364+ done
365+
366+ if [ $inplace -eq 1 ]; then
367+ sed -i ' ' " ${transformed[@]} "
368+ else
369+ sed " ${transformed[@]} "
370+ fi
343371 ;;
344372 * )
345373 sed " $@ "
You can’t perform that action at this time.
0 commit comments