Date: Wed, 19 Apr 2006 10:06:27 -0700 From: Brooks Davis <brooks@one-eyed-alien.net> To: Peter Jeremy <peterjeremy@optushome.com.au> Cc: freebsd-hackers@freebsd.org, cokane@cokane.org Subject: Re: [PATCH] Fancy rc startup style RFC Message-ID: <20060419170627.GA11251@odin.ac.hmc.edu> In-Reply-To: <20060419075721.GB704@turion.vk2pj.dyndns.org> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060419170627.GA11251>