string comparisons in C

Steve Summit scs at adam.pika.mit.edu
Sat Jul 15 12:26:12 AEST 1989


In article <44672745.14a1f at gtephx.UUCP> covertr at gtephx.UUCP (Richard E. Covert) writes:
>P.S. Does anyone know if pnmatch() is implemented on other C compilers??

No vendor should provide a routine named "pnmatch."  Vendors are
not supposed to pollute the namespace with "convenient" (but
invariably unportable and system-specific) routines.  ("Then why
do so may vendors do so?" you ask.)  Vendor-supplied routines not
mentioned in the standard are supposed to have names beginning
with at least one underscore (e.g. "_pnmatch").

Similarly, portable programs cannot really use these extensions,
no matter how convenient they may be.  When extensions are used,
they should be hidden behind at least one function call; that is,
don't call pnmatch directly, but rather invent your own routine --
"match_filenames" or something, which calls pnmatch.  Then, when
you port your code to a different system that doesn't have
pnmatch or uses some wildly different wildcard mechanism, you
only have to rewrite match_filenames().

                                            Steve Summit
                                            scs at adam.pika.mit.edu



More information about the Comp.lang.c mailing list