From ec66213424e671c70d1d8dd3675b85ae24d10e5f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 2 May 2018 22:32:07 -0700 Subject: Add uuidgen. Reuse create_uuid, but make it match the current RFC. --- toys/pending/uuidgen.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 toys/pending/uuidgen.c (limited to 'toys') 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)); +} -- cgit v1.2.3