mirror of
https://github.com/NaomiAmethyst/dots.git
synced 2025-08-05 16:48:38 +00:00
Prefer ruby to do the magic, use python if no perl
This commit is contained in:
parent
a7c412e980
commit
38624a82ea
1 changed files with 6 additions and 1 deletions
|
@ -10,11 +10,16 @@ unkey_host ()
|
||||||
|
|
||||||
err ()
|
err ()
|
||||||
{
|
{
|
||||||
if [ -e /usr/include/errno.h ] ; then
|
if ( command -v ruby > /dev/null 2>&1 ); then
|
||||||
|
ruby -e "Errno.constants.map{|errstr| errno = eval('Errno::' + errstr + '::Errno'); puts errstr if errno == $@}"
|
||||||
|
elif [ -e /usr/include/errno.h ] ; then
|
||||||
cpp -dM /usr/include/errno.h | grep -w "E.* $@"
|
cpp -dM /usr/include/errno.h | grep -w "E.* $@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ( command -v perl > /dev/null 2>&1 ) ; then
|
if ( command -v perl > /dev/null 2>&1 ) ; then
|
||||||
perl -MPOSIX -e 'print strerror($ARGV[0])."\n";' $@
|
perl -MPOSIX -e 'print strerror($ARGV[0])."\n";' $@
|
||||||
|
elif ( command -v python > /dev/null 2>&1 ) ; then
|
||||||
|
python -c "import os;print(os.strerror($@))"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue