mythbuntu-dev team mailing list archive
-
mythbuntu-dev team
-
Mailing list archive
-
Message #00029
Re: [Merge] lp:~kirkland/ubuntu-dev-tools/612267 into lp:ubuntu-dev-tools
Just because I felt like wasting time, I tried to improve some of 'errno' tool there, which I find quite useful.
The result is generally faster, with less forks, relying on matching of sed and awk or shell rather than a grep. The only thing non-standard is the use of 'I' in sed 's' for case insensitivity. I checked that that is supported by busybox's sed as well as gnu's.
if $(which gcc >/dev/null); then
# Header finding trick from Kees Cook <kees@xxxxxxxxxx>
headers=$(echo "#include <asm/errno.h>" | gcc -E - | awk -F\" '$2 ~ /\.h/ { print $2}' | sort -u)
else
headers="/usr/include/asm-generic/errno*.h"
fi
for code in "${@}"; do
if [ "$code" -le 0 -o "$code" -ge 0 ] 2>/dev/null; then
# Input is a number, search for a particular matching code
sed -n "s,^#define\s\+\([^\s]\+\s\+${code}\s.*\),\1,p" ${headers}
else
# Input is not a number, search for any matching strings
sed -n "s,^#define\s\+\(.*${code}.*\),\1,Ip" ${headers}
fi
done
--
https://code.launchpad.net/~kirkland/ubuntu-dev-tools/612267/+merge/32216
Your team Ubuntu Development Team is requested to review the proposed merge of lp:~kirkland/ubuntu-dev-tools/612267 into lp:ubuntu-dev-tools.
References