librelist archives

« back to archive

m2sh uuid

m2sh uuid

From:
Pasha
Date:
2010-09-26 @ 17:03
The manual still refers to `m2sh uuid`, but this command is missing in
the new version of the utility.

I have patched it locally and could have committed as well, but not
sure it's ok because it introduces
a dependency on libuuid. May be it's the reason this command has been
left out in the second incarnation of m2sh.

So, I let you know first and here is the diff:

 #include <task/task.h>
 #include <register.h>
+#include <uuid/uuid.h>

 typedef int (*Command_handler_cb)(Command *cmd);

 typedef struct CommandHandler {
     const char *name;
@@ -590,10 +591,20 @@
 #undef VERSION

     return 0;
 }

+static int Command_uuid(Command *cmd)
+{
+    uuid_t uuid;
+    char uuid_buf[37] = {0};
+    uuid_generate(uuid);
+    uuid_unparse(uuid, uuid_buf);
+    printf("%s\n", uuid_buf);
+    return 0;
+}
+

 static int Command_help(Command *cmd);

 static CommandHandler COMMAND_MAPPING[] = {
     {.name = "load", .cb = Command_load,
@@ -624,10 +635,12 @@
         .help = "Connects to the control port." },
     {.name = "version", .cb = Command_version,
         .help = "Prints the Mongrel2 and m2sh version." },
     {.name = "help", .cb = Command_help,
         .help = "Get help, lists commands." },
+    {.name = "uuid", .cb = Command_uuid,
+        .help = "Prints out a randomly generated UUID." },
     {.name = NULL, .cb = NULL, .help = NULL}
 };

P.S.

Man, it was so easy to patch, it really turned me on. The mongrel2
code is sweeeet!

-- 
Good luck,

Pasha Bastov

Re: [mongrel2] m2sh uuid

From:
Zed A. Shaw
Date:
2010-09-26 @ 18:01
On Sun, Sep 26, 2010 at 11:03:09PM +0600, Pasha wrote:
> The manual still refers to `m2sh uuid`, but this command is missing in
> the new version of the utility.
> 
> I have patched it locally and could have committed as well, but not
> sure it's ok because it introduces
> a dependency on libuuid. May be it's the reason this command has been
> left out in the second incarnation of m2sh.
>

Ok cool, I was going to have people just start using uuidgen, but let me
see if this builds on OSX and then we'll keep it.  Well, assuming you
aren't doing this on OSX.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] m2sh uuid

From:
Pasha
Date:
2010-09-26 @ 18:42
I'm on ArchLinux, so let's wait for the feedback from OSX folks.

On Mon, Sep 27, 2010 at 12:01 AM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:
> On Sun, Sep 26, 2010 at 11:03:09PM +0600, Pasha wrote:
>> The manual still refers to `m2sh uuid`, but this command is missing in
>> the new version of the utility.
>>
>> I have patched it locally and could have committed as well, but not
>> sure it's ok because it introduces
>> a dependency on libuuid. May be it's the reason this command has been
>> left out in the second incarnation of m2sh.
>>
>
> Ok cool, I was going to have people just start using uuidgen, but let me
> see if this builds on OSX and then we'll keep it.  Well, assuming you
> aren't doing this on OSX.
>
> --
> Zed A. Shaw
> http://zedshaw.com/
>



-- 
Good luck,

Pasha Bastov

Re: [mongrel2] m2sh uuid

From:
Zed A. Shaw
Date:
2010-09-26 @ 19:27
On Mon, Sep 27, 2010 at 12:42:30AM +0600, Pasha wrote:
> I'm on ArchLinux, so let's wait for the feedback from OSX folks.

Yep, OSX doesn't have libuuid but it does have uuidgen.  I think you'll
like my patch. :-)

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] m2sh uuid

From:
Pasha
Date:
2010-09-27 @ 03:51
Haha!

It's cool.

On Mon, Sep 27, 2010 at 1:27 AM, Zed A. Shaw <zedshaw@zedshaw.com> wrote:
> On Mon, Sep 27, 2010 at 12:42:30AM +0600, Pasha wrote:
>> I'm on ArchLinux, so let's wait for the feedback from OSX folks.
>
> Yep, OSX doesn't have libuuid but it does have uuidgen.  I think you'll
> like my patch. :-)
>
> --
> Zed A. Shaw
> http://zedshaw.com/
>



-- 
Good luck,

Pasha Bastov