aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-05-02 22:32:07 -0700
committerRob Landley <rob@landley.net>2018-05-03 18:59:01 -0500
commitec66213424e671c70d1d8dd3675b85ae24d10e5f (patch)
tree1e8d8da82930b2dc54d5796f6cca8776049649c3 /toys/pending
parent3169d948c049664bcf7216d4c4ae751881099d3e (diff)
downloadtoybox-ec66213424e671c70d1d8dd3675b85ae24d10e5f.tar.gz
Add uuidgen.
Reuse create_uuid, but make it match the current RFC.
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/uuidgen.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/toys/pending/uuidgen.c b/toys/pending/uuidgen.c
new file mode 100644
index 00000000..682dec4c
--- /dev/null
+++ b/toys/pending/uuidgen.c
@@ -0,0 +1,25 @@
+/* uuidgen.c - Create a new random UUID
+ *
+ * Copyright 2018 The Android Open Source Project
+ *
+ * UUID RFC: https://tools.ietf.org/html/rfc4122
+
+USE_UUIDGEN(NEWTOY(uuidgen, ">0r(random)", TOYFLAG_USR|TOYFLAG_BIN))
+
+config UUIDGEN
+ bool "uuidgen"
+ default n
+ help
+ usage: uuidgen
+
+ Create and print a new RFC4122 random UUID.
+*/
+
+#define FOR_uuidgen
+#include "toys.h"
+
+void uuidgen_main(void)
+{
+ create_uuid(toybuf);
+ puts(show_uuid(toybuf));
+}