/* GUID is used e.g. in GPT (GUID Partition Table) as a partiions unique id.  */
int uuid_str_valid(const char *uuid)
/* GUID is used e.g. in GPT (GUID Partition Table) as a partiions unique id.  */
int uuid_str_valid(const char *uuid)
{
	int i, valid;
	if (uuid == NULL)
		return 0;
	for (i = 0, valid = 1; uuid[i] && valid; i++) {
		switch (i) {
		case 8: case 13: case 18: case 23:
			valid = (uuid[i] == '-');
			break;
		default:
			valid = isxdigit(uuid[i]);
			break;
		}
	}
	if (i != UUID_STR_LEN || !valid)
		return 0;
	return 1;
}