diff options
author | jilles <jilles@FreeBSD.org> | 2011-05-14 12:22:58 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2011-05-14 12:22:58 +0000 |
commit | ea495298d64793bf9a180b62ff582d7054dcee5d (patch) | |
tree | c9b8b530c778e132fa9aa58bf853387cbb29f799 /etc/network.subr | |
parent | 2d58907623971ba909cb89ba53e639d811d6511e (diff) | |
download | FreeBSD-src-ea495298d64793bf9a180b62ff582d7054dcee5d.zip FreeBSD-src-ea495298d64793bf9a180b62ff582d7054dcee5d.tar.gz |
network.subr: Use printf(1) builtin for hexprint function.
Now that printf(1) is a shell builtin, there is no need to emulate it
anymore. The external printf(1) is /usr/bin/printf and therefore may not be
available in early boot.
It may be faster to use printf directly but the function is useful for
compatibility.
Diffstat (limited to 'etc/network.subr')
-rw-r--r-- | etc/network.subr | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/etc/network.subr b/etc/network.subr index afd568c..8185c5a 100644 --- a/etc/network.subr +++ b/etc/network.subr @@ -1333,38 +1333,14 @@ get_default_if() # Echo decimal number $arg (single digit) in hexadecimal format. hexdigit() { - if [ $1 -lt 10 ]; then - echo $1 - else - case $1 in - 10) echo a ;; - 11) echo b ;; - 12) echo c ;; - 13) echo d ;; - 14) echo e ;; - 15) echo f ;; - esac - fi + printf '%x\n' "$1" } # hexprint arg # Echo decimal number $arg (multiple digits) in hexadecimal format. hexprint() { - local val str dig - val=$1 - str='' - dig=`hexdigit $((${val} & 15))` - str=${dig}${str} - val=$((${val} >> 4)) - - while [ ${val} -gt 0 ]; do - dig=`hexdigit $((${val} & 15))` - str=${dig}${str} - val=$((${val} >> 4)) - done - - echo ${str} + printf '%x\n' "$1" } is_wired_interface() |