* errno, doc/errno.1, debian/control, debian/copyright, setup.py:

- add an errno utility, LP: #612267
This commit is contained in:
Kees Cook 2010-08-10 11:53:43 -07:00
commit 1aab6931a6
6 changed files with 74 additions and 1 deletions

5
debian/changelog vendored
View File

@ -1,5 +1,10 @@
ubuntu-dev-tools (0.102) UNRELEASED; urgency=low
[ Dustin Kirkland ]
* errno, doc/errno.1, debian/control, debian/copyright, setup.py:
- add an errno utility, LP: #612267
[ Kees Cook ]
* mk-sbuild: update examples to include "-A".
-- Kees Cook <kees@ubuntu.com> Tue, 10 Aug 2010 11:46:32 -0700

1
debian/control vendored
View File

@ -51,6 +51,7 @@ Description: useful tools for Ubuntu developers
all .so files in a binary package.
- dch-repeat - used to repeat a change log into an older release.
- dgetlp - download a source package from the Launchpad library.
- errno - search POSIX error codes by error number, name, or description
- get-branches - used to branch/checkout all the bzr branches in a Launchpad
team.
- get-build-deps - install the build dependencies needed for a package

4
debian/copyright vendored
View File

@ -8,6 +8,7 @@ Upstream Authors:
Bryce Harrington <bryce@ubuntu.com>
Daniel Hahler <ubuntu@thequod.de>
Daniel Holbach <daniel.holbach@ubuntu.com>
Dustin Kirkland <kirkland@ubuntu.com>
Emmet Hikory <persia@ubuntu.com>
Iain Lane <iain@orangesquash.org.uk>
James Westby <james.westby@ubuntu.com>
@ -35,6 +36,7 @@ Copyright:
(C) 2007, Albert Damen <albrt@gmx.net>
(C) 2006-2007, Albin Tonnerre <lut1n.tne@gmail.com>
(C) 2006-2007, Daniel Holbach <daniel.holbach@ubuntu.com>
(C) 2010, Dustin Kirkland <kirkland@ubuntu.com>
(C) 2008, Iain Lane <iain@orangesquash.org.uk>
© 2009, James Westby <james.westby@ubuntu.com>
(C) Jamin W. Collins <jcollins@asgardsrealm.net>
@ -73,7 +75,7 @@ licensed under the GNU General Public License, version 2:
On Debian and Ubuntu systems, the complete text of the GNU General Public
License v2 can be found in `/usr/share/common-licenses/GPL-2'.
dch-repeat, get-branches, get-build-deps, grab-attachments, grab-merge,
dch-repeat, errno, get-branches, get-build-deps, grab-attachments, grab-merge,
hugdaylist, manage-credentials, massfile, merge-changelog, mk-sbuild,
pbuilder-dist-simple, pull-debian-debdiff, pull-debian-source, pull-lp-source,
pull-revu-source, setup-packaging-environment, suspicious-source, ubuntu-build

22
doc/errno.1 Normal file
View File

@ -0,0 +1,22 @@
.TH errno 1 "10 Aug 2010" ubuntu-dev-tools "ubuntu-dev-tools"
.SH NAME
errno \- search POSIX error codes by error number, error name, or error description
.SH DESCRIPTION
\fBerrno\fP is a simple script that interprets a POSIX error code, or finds error codes related to a search string.
.SH EXAMPLE
$ errno 36
ENAMETOOLONG 36 /* File name too long */
$ errno perm
EPERM 1 /* Operation not permitted */
EACCES 13 /* Permission denied */
.SH SEE ALSO
\fBerrno\fP(2)\fP, \fBerrno\fP(3), \fI/usr/include/asm/errno.h\fP
.SH AUTHOR
This manpage and the utility was written by Dustin Kirkland <kirkland@ubuntu.com> for Ubuntu systems (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 published by the Free Software Foundation.
On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.

42
errno Executable file
View File

@ -0,0 +1,42 @@
#!/bin/sh -e
#
# errno - search POSIX error codes by error number, error name,
# or error description
#
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if which gcc >/dev/null; then
# 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)
else
headers="/usr/include/asm-generic/errno*.h"
fi
code="$1"
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\+\([^[:space:]]\+\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

View File

@ -20,6 +20,7 @@ setup(name='ubuntu-dev-tools',
'dch-repeat',
'dgetlp',
'edit-patch',
'errno',
'get-branches',
'get-build-deps',
'grab-attachments',