On Fri, 3 Sep 2004, Greg Miller wrote:

>Christian Smith wrote:
>
>> I found it funny, while looking through Dr Dobbs journal some time ago,
>> about a columnist (Al Stevens, I think!) being surprised that under UNIX,
>> such things as filename globbing was done by the shell, and all main()
>> usually gets is a list of valid filenames. Under DOS and Windows, given:
>>
>>   C:\Temp> grep foo *
>>
>> The '*' would have to be interpreted and expanded by the grep program, but
>> under UNIX, the list of files is generated by the shell. Of course, you
>> can get decent shells on Windows as well, but generally only as ports of
>> UNIX shells.
>
>
>I guess the UNIX folks just didn't know any better way back then.
>Putting globbing in the API instead of the shell is a much better
>approach, but that wasn't all that obvious when UNIX first came along.

You condone the DOS/Windows (lack of) approach?

Put it in a library, yes. But it is still best done by the shell (IMHO.)
The shell is written once, so for the common case, globbing only has to be
implemented in one place.

Having every utility do it's own globbing results is code reuse for the
sake of code reuse. I prefer just having a list of files the user wants
manipulated.

Christian


-- 
    /"\
    \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
     X                           - AGAINST MS ATTACHMENTS
    / \

Reply via email to