Small change to wc

Mike Meyer mwm-keyword-freebsdhackers2.e313df at mired.org
Fri Dec 5 15:40:17 PST 2008


On Sat, 6 Dec 2008 01:14:58 +0200
Kostik Belousov <kostikbel at gmail.com> wrote:

> On Fri, Dec 05, 2008 at 03:10:56PM -0800, Sheldon Givens wrote:
> > What's the problem having it? The total code is mere bytes and it eases the
> > transition for others who are migrating from Linux.
> > You're absolutely right in that it can be done with awk (fairly simply, too)
> > but it doesn't hurt to explore options. Additionally, with awk, you can't
> > get other figures with the same command, which increases ease of use.
> > IE: What's the equivalent to "wc -clwL" in awk? Would you really rather run
> > wc -clw && awk '{if(length>x){x=length}}END{if(x>0){print x}else{print
> > 0}}'`?
> > 
> > Isn't wc -L a more elegant solution than awk
> > '{if(length>x){x=length}}END{if(x>0){print x}else{print 0}}'`?
> > 
> > Should I continue?
> 
> Real argument pro is that you have one less thing to worry when you
> trying to run some script, written on Linux, on the FreeBSD system.

Real argument con is that you're making life easier on users of
GNU/Linux software whose authors ought to be taught how to write
portable code.

I think compatibility with GNU/Linux is a miserable reason for
bloating software on BSD - especially considering how NU the typical
GNU/Linux extensions are. However, this seems like a useful feature in
and of itself, and fits in well with the command it's being added to.
So adding it - and adding it to wc - seem like reasonable things. And
if we're going to add a feature to a command, making it compatible
with an existing implementation seems like a good idea.

       <mike
-- 
Mike Meyer <mwm at mired.org>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org


More information about the freebsd-hackers mailing list