mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-20 13:21:28 +00:00
parent
590901e51c
commit
99ddf5fd61
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -2,7 +2,7 @@ ubuntu-dev-tools (0.102) UNRELEASED; urgency=low
|
|||||||
|
|
||||||
[ Dustin Kirkland ]
|
[ Dustin Kirkland ]
|
||||||
* errno, doc/errno.1, debian/control, debian/copyright, setup.py:
|
* errno, doc/errno.1, debian/control, debian/copyright, setup.py:
|
||||||
- add an errno utility, LP: #61226
|
- add an errno utility, LP: #612267
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 10 Aug 2010 11:41:10 -0400
|
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 10 Aug 2010 11:41:10 -0400
|
||||||
|
|
||||||
|
24
errno
24
errno
@ -2,8 +2,14 @@
|
|||||||
#
|
#
|
||||||
# errno - search POSIX error codes by error number, error name,
|
# errno - search POSIX error codes by error number, error name,
|
||||||
# or error description
|
# or error description
|
||||||
|
#
|
||||||
# Copyright (C) 2010 Dustin Kirkland <kirkland@ubuntu.com>
|
# Copyright (C) 2010 Dustin Kirkland <kirkland@ubuntu.com>
|
||||||
#
|
#
|
||||||
|
# Authors:
|
||||||
|
# Dustin Kirkland <kirkland@ubuntu.com>
|
||||||
|
# Kees Cook <kees@ubuntu.com>
|
||||||
|
# Scott Moser <smoser@ubuntu.com>
|
||||||
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License.
|
# the Free Software Foundation, either version 3 of the License.
|
||||||
@ -16,7 +22,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if $(which gcc >/dev/null); then
|
if which gcc >/dev/null; then
|
||||||
# Header finding trick from Kees Cook <kees@ubuntu.com>
|
# Header finding trick from Kees Cook <kees@ubuntu.com>
|
||||||
headers=$(echo "#include <asm/errno.h>" | gcc -E - | grep "\.h" | awk -F\" '{print $2}' | sort -u)
|
headers=$(echo "#include <asm/errno.h>" | gcc -E - | grep "\.h" | awk -F\" '{print $2}' | sort -u)
|
||||||
else
|
else
|
||||||
@ -25,10 +31,12 @@ fi
|
|||||||
|
|
||||||
code="$1"
|
code="$1"
|
||||||
|
|
||||||
if echo "$code" | egrep -qs "^[0-9]+$"; then
|
for code in "${@}"; do
|
||||||
# Input is a number, search for a particular matching code
|
if [ "$code" -le 0 -o "$code" -ge 0 ] 2>/dev/null; then
|
||||||
egrep -h "^#define\s.*\s+$code\s+/" $headers | sed 's/^#define\s*//'
|
# Input is a number, search for a particular matching code
|
||||||
else
|
sed -n "s,^#define\s\+\([^[:space:]]\+\s\+${code}\s.*\),\1,p" ${headers}
|
||||||
# Input is not a number, search for any matching strings
|
else
|
||||||
grep -hi "$code" $headers | sed 's/^#define\s*//'
|
# Input is not a number, search for any matching strings
|
||||||
fi
|
sed -n "s,^#define\s\+\(.*${code}.*\),\1,Ip" ${headers}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user