delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/29/22:49:01

Date: Thu, 29 Jan 1998 19:47:09 -0800 (PST)
Message-Id: <199801300347.TAA01888@adit.ap.net>
Mime-Version: 1.0
To: Noam Rotem <nrotem AT johnbryce DOT co DOT il>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: *argv[] help!

At 09:56  1/29/1998 PST, Noam Rotem wrote:
>
>--- On 29 Jan 1998 06:58:46 GMT  George Foot <mert0407 AT sable DOT ox DOT ac DOT uk> 
>wrote:
>
>>DJGPP performs command-line globbing automatically, like Unix shells
>>do.  This means that if you give a wildcard on the command line it
>>will be expanded into the list of files matching the wildcard -- so in
>>your case argv[1] would be the first, argv[2] the second, etc.
>
>Can I use the automatic globbing for more than one argument with wildcards?
>Let's say my command line is:
>
>foo *.c *.bck
>
>I guess I'll get the matching files of both arguments in argv[i], but how 
>would I know then where goes the line between *.c's globbed arguments and 
>*.bck's?
AFAIK, there is no way of knowing. Not portably, that is. You can use the
usual DJGPP methods of preventing globbing, then parse the command line
yourself, doing the globbing with the `glob' function. But under another
system, like Unix, the globbing is done by the shell and your program has no
idea what the user actually typed.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019