[comp.lang.c] Wildcard Expansion

franka@mmintl.UUCP (Frank Adams) (04/14/88)

[Conversation redirected to comp.misc; this isn't about C any more.]

In article <1038@mcgill-vision.UUCP> mouse@mcgill-vision.UUCP (der Mouse) writes:
>In fact, any pattern whose name portion begins with a * behaves as if there
>were nothing else in the name portion....  *This* you surely do not consider
>sensible.

No, indeed it is not.  I can understand why, in a small (toy) operating
system like MS-DOS, one would choose not to support wildcards with
non-terminal *'s.  (I might have chosen differently, but the choice is at
least sensible.)  But, in this case, one should at least generate an error
message, instead of quietly doing the wrong thing.
-- 

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Ashton-Tate          52 Oakland Ave North         E. Hartford, CT 06108

paulb@ttidca.TTI.COM (Paul Blumstein) (02/01/90)

In article <8466@pogo.WV.TEK.COM> bluneski@pogo.WV.TEK.COM (Bob Luneski) writes:
+Does anyone have a general wildcard expansion code in C or 68000 Assembler?
+Something like given a filename and a wildcard mask, is the file covered
+by the mask?? 

See if your system has re_comp & re_exec.  Those routines will do what you
want.
=============================================================================
Paul Blumstein    | Is it proper to ask the C.E. fixing your MIDI system
Citicorp/TTI      | whether it will ever be able to play the violin again?
Santa Monica, CA  +----------------------------------------------------------
{philabs,csun,psivax}!ttidca!paulb  or  paulb@ttidca.TTI.COM
DISCLAIMER: Don't believe everything I hear or anything you say.

karl@haddock.ima.isc.com (Karl Heuer) (02/01/90)

In article <9460@ttidca.TTI.COM> paulb@ttidca.TTI.COM (Paul Blumstein) writes:
>In article <8466@pogo.WV.TEK.COM> bluneski@pogo.WV.TEK.COM (Bob Luneski) writes:
>>Does anyone have a general wildcard expansion code...
>See if your system has re_comp & re_exec...

Wildcard globbing is not the same thing as regexp matching.  You could do it
that way, but you'd have to translate the wildcard pattern to a regexp first.

Also, re_comp and re_exec are Berkeleyisms.  On SysV you're more likely to
have <regexp.h> instead.  (Henry Spencer's regexp routines are better than
either of those, so that may be the best approach.)

I've sent Paul a globbing routine by email.

Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint

karl@haddock.ima.isc.com (Karl Heuer) (02/03/90)

In article <15821@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes:
>[After explaining the difference between globbing and regexping]
>I've sent Paul a globbing routine by email.

Oops, I misread the attributions.  s/Paul/Bob/