bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Behavior of glob/fnmatch with square brackets


From: Andreas Schwab
Subject: Re: Behavior of glob/fnmatch with square brackets
Date: Tue, 05 Aug 2003 22:47:12 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux)

"David W. Bettis" <address@hidden> writes:

|> > |> Greetings,
|> > |> 
|> > |> Consider the following snippet of code:
|> > |> 
|> > |> 
|> > |>         int    result_code;
|> > |> 
|> > |>         /* check to see if [foo]/bar matches the pattern [foo]/* */
|> > |>         if((result_code = fnmatch("\\[foo\\]/*", "\\[foo\\]/bar", 0)) 
== 0)
|> 
|> > Code and comment disagree, so probably both are wrong.
|> 
|> Code and comment DO agree.

No, they don't.  '\[foo\]/bar' != '[foo]/bar'.

|> The intent is to match ALL files under the directory '[foo]'.

But the file is under the directory '\[foo\]'.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 N├╝rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]