Subject: Re: which echo.c would you choose?
To: None <firstname.lastname@example.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 11/30/1999 01:42:48
>> - Use strcmp for -n. Reason: efficiency difference is lost in the
>> noise, so the maintainability advantage takes over.
> I'd rather see "use something very similar to getopt", because that's
> more canonical, although I don't know what echo is *supposed* to do
> with "--". :)
Each version included a comment remarking that echo is not allowed to
use getopt. Whether or not this is true according to any standard,
since they are all identical in that respect, it is not a basis to
compare them on.
>> If I had to choose among only the four programs presented, I would
>> probably pick B, unless handling \c were important, in which case A
>> would be the only candidate on simple functionality grounds.
> I would say that '\c' is moderately-useful, although not stunningly
> necessary. It's a SYSV'ism, but it's a common enough guess for shell
> scripts that it might as well be supported.
I really don't care much for either -n or \c, since they make it hard
to output "-n" or "\c", respectively. In particular, when the thing to
be echoed might have -n as its first argument, or might end with \c,
the only option is to add guard characters and then throw them away
later with something like tr or sed - and that's nontrivial when the
thing being echoed might contain newlines. I'd rather see, say, "echo"
and "echon" commands...and yes, I realize that battle was lost long
For NetBSD's use, you may be right. But the post did not say anything
about being suitable for NetBSD's use being any part of the goodness
metric, though it seems likely one of them is the NetBSD echo.c (I
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B