Skip to content

Commit

Permalink
units: Don't use extended regular expressions in sed
Browse files Browse the repository at this point in the history
Non-GNU sed implementation, in particular 4.2BSD (OSX), do not support the `-r`
option. This change makes the script portable for such systems.
  • Loading branch information
vhda committed Feb 28, 2015
1 parent 9cb031d commit e4b28d8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions misc/units
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ run_shrink ()
}

# filters out the directory prefix in a ctags input
tags_basename_filter_regex='s%(^[^\t]+\t)([^/\t]+/)*%\1%'
tags_basename_filter_regex='s%\(^[^ ]\{1,\} \)\([^/ ]\{1,\}/\)*%\1%'
tags_basename_filter()
{
sed -r "${tags_basename_filter_regex}"
sed "${tags_basename_filter_regex}"
}

run_record_cmdline ()
Expand All @@ -304,7 +304,7 @@ run_record_cmdline ()

printf "%s \\\\\n| %s \\\\\n| %s\n" \
"${_CMDLINE}" \
"sed -r '${tags_basename_filter_regex}'" \
"sed '${tags_basename_filter_regex}'" \
"${ffilter}" \
> "${ocmdline}"
}
Expand Down Expand Up @@ -363,7 +363,7 @@ run_tcase ()
#
# Filtered by LANGUAGES
#
guessed_lang=$( ${_CMDLINE} --print-language "$input" 2>/dev/null | sed -nr 's/^.*: (.+)$/\1/p')
guessed_lang=$( ${_CMDLINE} --print-language "$input" 2>/dev/null | sed -n 's/^.*: //p')
if [ -n "${LANGUAGES}" ]; then
member_p "${guessed_lang}" ${LANGUAGES} || return 1
fi
Expand Down Expand Up @@ -1459,7 +1459,7 @@ noise_lang_file ()
local offset
local guessed_lang

guessed_lang=$( ${_CMDLINE_FOR_SHRINKING} --print-language "${input}" 2>/dev/null | sed -nr 's/^.*: (.+)$/\1/p')
guessed_lang=$( ${_CMDLINE_FOR_SHRINKING} --print-language "${input}" 2>/dev/null | sed -n 's/^.*: //p')
if [ "${lang}" != "${guessed_lang}" ]; then
return 0
fi
Expand Down

0 comments on commit e4b28d8

Please sign in to comment.