small bug in who(1) of SVR3

John F Haugh II jfh at rpp386.cactus.org
Mon Jan 14 07:45:11 AEST 1991


In article <1991Jan13.004843.18650 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
>In article <18896 at rpp386.cactus.org> jfh at rpp386.cactus.org (John F Haugh II) writes:
>>... Why should I be forced to... use pipes (ala "who | 
>>cut -d' ' -f1 | pr -6 -l1) to get the same results as "who -q"?
>
>Because they are the simplest and cheapest way to get the desired results?

How can you possibly say that?  The amount of machine overhead in the
above case is several times greater than "who -q".  In which sense is
it "the simplest and cheapest way"?

>I don't care how easy it was to add the "-q" option, it was a waste of the
>programmer's time.  A shell program using pipes could have been written in
>seconds, solving the problem without messing around with "who".

Sure, I managed to write that little blurb in about 5 seconds.  Most of that
time was spent considering if I wanted to sort the list (ala BSD "users"
command) or not.

However, once you add yet another program you have to add all of the support
that goes into having yet another file to hold the source, yet another file
to hold the documentation, yet another file to hold any test cases, etc.

>There seems to be a pervasive delusion that the only two ways things can
>be done are (a) add every conceivable option to the C program or (b) force
>the user to type long sequences using pipes.  The correct approach, when
>such functionality is often used, is to package it up in a system-supplied
>shell file.

Straw man.  No one is suggesting that "every conceivable option" be added
to the "who" command.  Given that BSD provides "users" and System V
provides "who -q", there is clearly a desire to have the functionality
described.  Adding the second command ("users") only increases the amount
of code which must be maintained with no resultant benefits in usablity
or performance.  fork() and exec() are neither free nor even cheap - shell
scripts are just not the right answer.

The "-q" option involves a very small code change and an additional
paragraph on a manpage which already has the heading "Lists who is on
the system".  The BSD manpage begins "compact list of users who are on
the system".  Which is clearer?  Two commands on two different pages,
or one command with one additional option?
-- 
John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832                           Domain: jfh at rpp386.cactus.org
"While you are here, your wives and girlfriends are dating handsome American
 movie and TV stars. Stars like Tom Selleck, Bruce Willis, and Bart Simpson."



More information about the Comp.bugs.sys5 mailing list