From owner-freebsd-rc@FreeBSD.ORG Sun May 8 18:59:32 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6202F106566C for ; Sun, 8 May 2011 18:59:32 +0000 (UTC) (envelope-from Devin.Teske@fisglobal.com) Received: from mx1.fisglobal.com (mx1.fisglobal.com [199.200.24.190]) by mx1.freebsd.org (Postfix) with ESMTP id 2C7588FC08 for ; Sun, 8 May 2011 18:59:31 +0000 (UTC) Received: from sbhfislrext02.fnfis.com ([192.168.249.140]) by SCSFISLTC02 (8.14.3/8.14.3) with ESMTP id p48IJtFA016418; Sun, 8 May 2011 13:19:55 -0500 Received: from SBHFISLTCGW04.FNFIS.COM (Not Verified[10.132.248.123]) by sbhfislrext02.fnfis.com with MailMarshal (v6, 5, 4, 7535) id ; Sun, 08 May 2011 13:20:03 -0500 Received: from sbhfisltcgw02.FNFIS.COM ([10.132.248.122]) by SBHFISLTCGW04.FNFIS.COM with Microsoft SMTPSVC(6.0.3790.4675); Sun, 8 May 2011 13:19:54 -0500 Received: from [10.0.0.102] ([10.132.254.136]) by sbhfisltcgw02.FNFIS.COM over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 8 May 2011 13:19:54 -0500 Mime-Version: 1.0 (Apple Message framework v1084) From: Devin Teske In-Reply-To: <20110508123745.GA83320@stack.nl> Date: Sun, 8 May 2011 11:19:52 -0700 Message-Id: References: <20110508123745.GA83320@stack.nl> To: Jilles Tjoelker X-Mailer: Apple Mail (2.1084) X-OriginalArrivalTime: 08 May 2011 18:19:54.0499 (UTC) FILETIME=[87746530:01CC0DAC] Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-rc@FreeBSD.org Subject: Re: [PATCH] Use printf(1) builtin for hexprint function in etc/network.subr X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 18:59:32 -0000 On May 8, 2011, at 5:37 AM, Jilles Tjoelker wrote: > Now that printf(1) is a shell builtin, there is no need to emulate it > anymore. Did you realize that when you committed printf(1) back to the sh(1) Makefil= e, you were about 28 hours away from the 9 year anniversary of when knu rem= oved it. knu removed printf(1) from the sh(1) makefile on Nov 20th, 2001, a= nd you brought it back on Nov 19th, 2010. According to: http://www.freebsd.org/cgi/cvsweb.cgi/src/bin/sh/Makefile Hallelujah!! Thank you so much for bringing printf(1) back as a builtin! An= ytime you're near San Francisco, I'll buy you a beer (seriously... _thank_ = _you_). --=20 Cheers, Devin >=20 > It may be faster to use printf directly but the function is useful for > compatibility. >=20 > Index: etc/network.subr > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- etc/network.subr (revision 220966) > +++ etc/network.subr (working copy) > @@ -1333,38 +1333,14 @@ > # 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" > } >=20 > # hexprint arg > # Echo decimal number $arg (multiple digits) in hexadecimal format. > hexprint() > { > - local val str dig > - val=3D$1 > - str=3D'' > - dig=3D`hexdigit $((${val} & 15))` > - str=3D${dig}${str} > - val=3D$((${val} >> 4)) > - > - while [ ${val} -gt 0 ]; do > - dig=3D`hexdigit $((${val} & 15))` > - str=3D${dig}${str} > - val=3D$((${val} >> 4)) > - done > - > - echo ${str} > + printf '%x\n' "$1" > } >=20 > is_wired_interface() >=20 > --=20 > Jilles Tjoelker > _______________________________________________ > freebsd-rc@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-rc > To unsubscribe, send any mail to "freebsd-rc-unsubscribe@freebsd.org" --=20 Cheers, Devin Teske -> CONTACT INFORMATION <- Business Solutions Consultant II FIS - fisglobal.com 510-735-5650 Mobile 510-621-2038 Office 510-621-2020 Office Fax 909-477-4578 Home/Fax devin.teske@fisglobal.com -> LEGAL DISCLAIMER <- This message contains confidential and proprietary information of the sender, and is intended only for the person(s) to whom it is addressed. Any use, distribution, copying or disclosure by any other person is strictly prohibited. If you have received this message in error, please notify the e-mail sender immediately, and delete the original message without making a copy. -> END TRANSMISSION <- _____________ The information contained in this message is proprietary and/or confidentia= l. If you are not the intended recipient, please: (i) delete the message an= d all copies; (ii) do not disclose, distribute or use the message in any ma= nner; and (iii) notify the sender immediately. In addition, please be aware= that any message addressed to our domain is subject to archiving and revie= w by persons other than the intended recipient. Thank you. _____________