From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 19 17:06:48 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0765E16A404 for ; Wed, 19 Apr 2006 17:06:48 +0000 (UTC) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0DD4243D7B for ; Wed, 19 Apr 2006 17:06:35 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id k3JH6Sjn014487; Wed, 19 Apr 2006 10:06:28 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id k3JH6Sed014486; Wed, 19 Apr 2006 10:06:28 -0700 Date: Wed, 19 Apr 2006 10:06:27 -0700 From: Brooks Davis To: Peter Jeremy Message-ID: <20060419170627.GA11251@odin.ac.hmc.edu> References: <444515C8.3030406@centtech.com> <20060418165709.GA17705@central.0xfce3.net> <44452532.40703@centtech.com> <20060418.114933.69380798.imp@bsdimp.com> <346a80220604181102v3597a1edp3e05fa663b87e15c@mail.gmail.com> <20060418193018.GB694@turion.vk2pj.dyndns.org> <444545D3.5010405@centtech.com> <20060419075721.GB704@turion.vk2pj.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline In-Reply-To: <20060419075721.GB704@turion.vk2pj.dyndns.org> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu Cc: freebsd-hackers@freebsd.org, cokane@cokane.org Subject: Re: [PATCH] Fancy rc startup style RFC X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Apr 2006 17:06:48 -0000 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 19, 2006 at 05:57:21PM +1000, Peter Jeremy wrote: > On Tue, 2006-Apr-18 15:02:27 -0500, Eric Anderson wrote: > >Peter Jeremy wrote: > >>>+ padding=3D"" > >>>+ paddingsize=3D$(($columns - 15 - $2 - $namesize)) > >>>+ until [ 0 =3D ${paddingsize} ]; do > >>>+ padding=3D" $padding" > >>>+ paddingsize=3D$(($paddingsize - 1)) > >>>+ done > >> > >>This particular block of code appears unnecessary (since $padding is=20 > >>unused). > > > >I must be missing something, because I'm pretty sure it's used.. What=20 > >did I miss? >=20 > Actually, I had a closer look and I was wrong, sorry. I missed the > '[ $2 =3D 0 ]' test. The code might be more legible (and is definitely > more efficient) if the above code was moved into the else clause for > that test. >=20 > Also '[ $2 =3D 0 ]' should probably be written as '[ "0$2" -eq 0 ]', or > similar, so that it doesn't blow up if there is no $2. Or better use "${2:-0}" if that's what you mean. The idiom of prepending stuff to a variable in a string to deal with the unassigned variables has always seemed to me like it was a hold over from some truly ancent shell without modern features. The '[ "x$var" =3D "x" ]' idiom is even worse. Test has only had -z and -n for a decade or two... -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --G4iJoqBmSsgzjUCe Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFERm4SXY6L6fI4GtQRAn69AJ9ZRvTJTKcVcBkQUkNA9tcgKBSYkACgoxm1 Cp+ipLnqMVO5UdsMl0I1W8A= =oEZy -----END PGP SIGNATURE----- --G4iJoqBmSsgzjUCe--