Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!haven!adm!cmcl2!acf3!sabbagh From: sabbagh@acf3.NYU.EDU (sabbagh) Newsgroups: comp.lang.c Subject: Re: string comparisons in C Keywords: C, awk, Dr. Dobb's Jnl Message-ID: <1055@acf3.NYU.EDU> Date: 14 Jul 89 13:43:06 GMT References: <44672745.14a1f@gtephx.UUCP> Reply-To: sabbagh@acf3.UUCP () Organization: New York University Lines: 29 In article <44672745.14a1f@gtephx.UUCP> covertr@gtephx.UUCP (Richard E. Covert) writes: [...Misc comments about string matching in C...] > But, I was browsing thru the MWC manual, and lo and behold I see >pnmatch(). Now pnmatch is a wonderful little function which does string >comparisons. And it even accepts wildcards, so I was in business. I just >build an array of strings such as "*.PI1", and then by looping thru the >array I can string compare a user inputted filename against the list of >legal filetypes. Pretty neat solution. > > So, the moral of this little ditty, is READ YOUR MANUAL!! > >P.S. Does anyone know if pnmatch() is implemented on other C compilers?? I can't answer the question about pnmatch, however, in the May or June issue of Dr. Dobb's Journal there is an article entitled "Adding Awk-like ext- ensions to C". This gave a description and SOURCE CODE for C routines that would perform AWK functions. For those non-Eunuchs (:-)) users out there, AWK is a "little" language whose primary usage is string processing. These extensions are very powerful and worth looking into. Hadil G. Sabbagh E-mail: sabbagh@csd27.nyu.edu Voice: (212) 998-3285 Snail: Courant Institute of Math. Sci. 251 Mercer St. New York,NY 10012 186,282 miles per second -- it's not just a good idea, it's the law!