From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e219d94b946dfc26 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Newsgroups: comp.lang.ada Subject: Re: Ada.Command_Line and wildcards References: <45dcaed8_6@news.bluewin.ch> <1172132169.423514.271890@s48g2000cws.googlegroups.com> <87hctei5pf.fsf@ludovic-brenta.org> From: Markus E Leypold Organization: N/A Date: Thu, 22 Feb 2007 19:34:46 +0100 Message-ID: User-Agent: Some cool user agent (SCUG) Cancel-Lock: sha1:Hl2QHgafUOQ3Gs6owTnhRBbGeR4= MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 88.72.254.141 X-Trace: news.arcor-ip.de 1172168946 88.72.254.141 (22 Feb 2007 19:29:06 +0200) X-Complaints-To: abuse@arcor-ip.de Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor-ip.de!news.arcor-ip.de!not-for-mail Xref: g2news2.google.com comp.lang.ada:9423 Date: 2007-02-22T19:34:46+01:00 List-Id: Jean-Pierre Rosen writes: > Ludovic Brenta a �crit : >> There are three such "other functions": >> $ cat '*.ads *.adb' | wc -l > loc.txt >> $ cat "*.ads *.adb" | wc -l > loc.txt >> $ cat \*.ads \*.adb | wc -l > loc.txt >> So could you please explain why you think the Unix behaviour is >> "wrong"? >> > No, that's from the user's side, not from the program's side. It > should be up to the program to decide whether "*" is to be interpreted > as a wild-card or not. Actually it ist. In find . -name '*.txt' the program 'find' decides to do the wildcard expansion on '*'. The wildcard expansion the shell does, is just an additional service. You can just not use it, by enclosing every word on the command line in "'". > > For example, I have a utility where I pass Ada unit names (not file > names), but wildcarding is allowed for the unit names (handled by the > program). If by chance I have a file that matches the wildcard in the > current directory, I get an absolutely useless parameter. And I hate > having to tell the user (even if I am the only known user of the > program :-) that the parameters must be quoted. That depends on the shell the user is using. Actually using a unix v5 or v6 shell will avoid the expansion :-). Seriously: If the user doesn't know how his/her shell works and that the shell contains a special sub-language to specify file sets it's not the program's nor the shell's fault: The user simply doesn't know his tools. By the same token we could forbid variable expansion in the shell, because the user might want to use filenames with '$'s in the (like my-$s-earned.tbl) and cannot be bother to learn to quote in this case. For the real hard cases I suggest to write a specialized interactive "shell" around you toolset (some modula compilers had such interactive modes, I think). The the user than cannot by accident type e.g. 'cat' and wait until infinity since he doesn't know what he did there. Regards -- Markus