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 Path: g2news2.google.com!news1.google.com!news.germany.com!feeder2.news.saunalahti.fi!feeder1.news.saunalahti.fi!nntp.inet.fi!inet.fi!fi.sn.net!newsfeed2.fi.sn.net!news.song.fi!not-for-mail Date: Thu, 22 Feb 2007 21:30:26 +0200 From: Niklas Holsti User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20060628 Debian/1.7.8-1sarge7.1 X-Accept-Language: en MIME-Version: 1.0 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <45ddef4d$0$24620$39db0f71@news.song.fi> Organization: TDC Song Internet Services NNTP-Posting-Host: laku61.adsl.netsonic.fi X-Trace: 1172172621 news.song.fi 24620 81.17.205.61:33163 X-Complaints-To: abuse@song.fi Xref: g2news2.google.com comp.lang.ada:9425 Date: 2007-02-22T21:30:26+02:00 List-Id: Markus E Leypold wrote: > 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 > "'". Moreover the shell's use of pathname expansion is usually optional and user-configurable. For example, under the "bash" shell the command "set -f" turns pathname expansion off, so all wildcard characters in later commands are passed unexpanded into command arguments even if not quoted. I agree with Markus that the Unix-style division of command-line management between the shell and the program is sensible. Of course an application should also be able to scan directories to find files with names that match a given pattern. In Ada 2005 the new predefined package Ada.Directories provides the tools for this. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .