1
0

2 Коммиты 3416e95b84 ... 3a5527860f

Автор SHA1 Сообщение Дата
  George C. Privon 3a5527860f add a short readme 6 месяцев назад
  George C. Privon 52b6454d48 use 4 spaces instead of tabs 6 месяцев назад
2 измененных файлов с 23 добавлено и 10 удалено
  1. 13 0
      README.md
  2. 10 10
      uuid-generator.c

+ 13 - 0
README.md

@@ -0,0 +1,13 @@
+# uuid-generator
+
+A short command line tool to generate and a UUIDv4 and print it to the screen.
+In its current form, relies on pledge() so will probably only compile on OpenBSD.
+
+To compile and run:
+
+```
+$ cc -o uuid-generator uuid-generator.c
+$ ./uuid-generator
+...
+```
+

+ 10 - 10
uuid-generator.c

@@ -8,22 +8,22 @@ int main() {
     /* restrict ourselves to standard IO */
     pledge("stdio", NULL);
 
-	/* allocate space to store a generated UUID, a string representation
+    /* allocate space to store a generated UUID, a string representation
      * and status/error information. */
-	void *myuuid;
-	char *myuuidstr;
-	uint32_t uuidstatus;
-	myuuid = malloc(sizeof(uuid_t));
+    void *myuuid;
+    char *myuuidstr;
+    uint32_t uuidstatus;
+    myuuid = malloc(sizeof(uuid_t));
 
     /* create a UUID (Version 4), convert it to a string representation,
      * and print it out to the screen. */
-	uuid_create(myuuid, &uuidstatus);
-	uuid_to_string(myuuid, &myuuidstr, &uuidstatus);
-	printf("%s\n", myuuidstr);
+    uuid_create(myuuid, &uuidstatus);
+    uuid_to_string(myuuid, &myuuidstr, &uuidstatus);
+    printf("%s\n", myuuidstr);
 
     /* free malloc()'ed memory. */
-	free(myuuid);
-	free(myuuidstr);
+    free(myuuid);
+    free(myuuidstr);
 
 return 0;
 }