Helper function for checking given suffix on path
This commit is contained in:
parent
c63f859b78
commit
f0f392cce6
|
@ -863,3 +863,11 @@ char * rpmEscapeSpaces(const char * s)
|
|||
*te = '\0';
|
||||
return t;
|
||||
}
|
||||
|
||||
int rpmFileHasSuffix(const char *path, const char *suffix)
|
||||
{
|
||||
size_t plen = strlen(path);
|
||||
size_t slen = strlen(suffix);
|
||||
return (plen >= slen &&
|
||||
strcmp(path+plen-slen, suffix) == 0);
|
||||
}
|
||||
|
|
|
@ -110,4 +110,12 @@ int rpmGlob(const char * patterns, int * argcPtr, char *** argvPtr);
|
|||
*/
|
||||
char * rpmEscapeSpaces(const char * s);
|
||||
|
||||
/**
|
||||
* Check if path (string) ends with given suffix
|
||||
* @param path (path) string
|
||||
* @param suffix suffix string to check for
|
||||
* @return 1 if true, 0 otherwise
|
||||
*/
|
||||
int rpmFileHasSuffix(const char *path, const char *suffix);
|
||||
|
||||
#endif /* _RPMFILEUTIL_H */
|
||||
|
|
Loading…
Reference in New Issue