MCPcopy Create free account
hub / github.com/GJDuck/e9patch / isLibraryFilename

Function isLibraryFilename

src/e9tool/e9misc.cpp:152–175  ·  view source on GitHub ↗

* Attempt to guess if the filename is a library or not. */

Source from the content-addressed store, hash-verified

150 * Attempt to guess if the filename is a library or not.
151 */
152bool isLibraryFilename(const char *filename)
153{
154 const char *str;
155 while ((str = strchr(filename, '/')) != nullptr)
156 filename = str+1;
157 str = strstr(filename, "lib");
158 if (str == nullptr)
159 return false;
160 str = strstr(str, ".so");
161 if (str == nullptr)
162 return false;
163 str += 3;
164 while (*str != '\0')
165 {
166 if (*str != '.')
167 return false;
168 str++;
169 if (!isdigit(*str++))
170 return false;
171 while (isdigit(*str))
172 str++;
173 }
174 return true;
175}
176
177/*
178 * Get path information.

Callers 2

parseELFMethod · 0.85
main_2Function · 0.85

Calls 2

strchrFunction · 0.85
isdigitFunction · 0.50

Tested by

no test coverage detected