(root)/
util-linux-2.39/
tests/
helpers/
test_uuid_namespace.c
       1  /*
       2   * SPDX-License-Identifier: GPL-2.0-or-later
       3   *
       4   * Copyright (C) 2017 Philip Prindeville <philipp@redfish-solutions.com>
       5   */
       6  #include <stdio.h>
       7  #include <stdlib.h>
       8  #include <string.h>
       9  
      10  #include "../libuuid/src/uuid.h"
      11  
      12  static void get_template(const char *ns)
      13  {
      14  	const uuid_t *uuidptr;
      15  	char buf[UUID_STR_LEN];
      16  
      17  	uuidptr = uuid_get_template(ns);
      18  	if (uuidptr == NULL)
      19  		strcpy(buf, "NULL");
      20  	else
      21  		uuid_unparse_lower(*uuidptr, buf);
      22  
      23  	printf("uuid_get_template %s returns %s\n", (ns ? ns : "NULL"), buf);
      24  }
      25  
      26  int main(void)
      27  {
      28  	get_template("dns");
      29  
      30  	get_template("url");
      31  
      32  	get_template("oid");
      33  
      34  	get_template("x500");
      35  
      36  	get_template(NULL);
      37  	get_template("");
      38  	get_template("unknown");
      39  
      40  	exit(0);
      41  }
      42