Sun Java System Web Server 7.0 Update 4 NSAPI Developer's Guide

shexp_cmp() Function

The shexp_cmp function validates a specified shell expression and compares it with a specified string. This returns one of three possible values representing match, no match, and invalid comparison. The comparison in contrast to the comparison made by the shexp_casecmp function is case sensitive.

Use this function for a shell expression like *.netscape.com and make sure that a string matches it, such as foo.netscape.com.

Syntax

int shexp_cmp(char *str, char *exp);

Return Values

0 if a match was found.

1 if no match was found.

-1 if the comparison resulted in an invalid expression.

Parameters

char *str is the string to be compared.

char *exp is the shell expression (wildcard pattern) to compare against.

Example

/* Use wildcard match to see if this path is one we want */
char *path;
char *match = "/usr/netscape/*";
if (shexp_cmp(path, match) != 0)    
    return REQ_NOACTION;   /* no match */

See Also

shexp_casecmp() Function, shexp_match() Function, shexp_valid() Function