Commit fcce9daa authored by Dan Williams's avatar Dan Williams
Browse files

core: add utility function nm_utils_is_uuid()

parent ccea4425
......@@ -988,3 +988,20 @@ nm_utils_complete_generic (NMConnection *connection,
}
}
gboolean
nm_utils_is_uuid (const char *str)
{
const char *p = str;
int num_dashes = 0;
while (*p) {
if (*p == '-')
num_dashes++;
else if (!isxdigit (*p))
return FALSE;
p++;
}
return (num_dashes == 4) && (p - str == 36);
}
......@@ -92,4 +92,6 @@ void nm_utils_complete_generic (NMConnection *connection,
const char *preferred,
gboolean default_enable_ipv6);
gboolean nm_utils_is_uuid (const char *str);
#endif /* NETWORK_MANAGER_UTILS_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment