Created
March 17, 2014 18:20
-
-
Save tftio/9605174 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <uuid/uuid.h> | |
#include <stdlib.h> | |
#include <libgen.h> | |
// cc -Wall -pedantic -Werror -o uuid uuid.c | |
// AND! | |
// ln uuid uuidt | |
// for uuid_generate_time() based uuids. | |
int main (int argc, const char ** argv) { | |
uuid_t uuid; | |
uuid_string_t uuid_str; | |
char * bname = basename((char *) argv[0]); | |
if (strncmp(bname, "uuidt", 5) == 0) { | |
uuid_generate_time(uuid); | |
} else { | |
uuid_generate(uuid); | |
} | |
uuid_unparse_lower(uuid, uuid_str); | |
printf("%s\n", uuid_str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment