diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-02-10 22:47:14 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-02-22 16:57:43 +0100 |
commit | d489071fb348cd180bc4f70e732b0e76d9804448 (patch) | |
tree | e20a7aef25557fe14c3331ae17a19cf2168cf556 | |
parent | afcd68c1498ba4d449b782f4703490a74770c5f4 (diff) |
journalct: also print Python code in --new-id
-rw-r--r-- | src/journal/journalctl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 0afeef932e..0de159b89a 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -462,14 +462,17 @@ static int generate_new_id128(void) { "As UUID:\n" "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n\n" "As macro:\n" - "#define MESSAGE_XYZ SD_ID128_MAKE(", + "#define MESSAGE_XYZ SD_ID128_MAKE(", SD_ID128_FORMAT_VAL(id), SD_ID128_FORMAT_VAL(id)); - for (i = 0; i < 16; i++) printf("%02x%s", id.bytes[i], i != 15 ? "," : ""); + fputs(")\n\n", stdout); - fputs(")\n", stdout); + printf("As Python constant:\n" + ">>> import uuid\n" + ">>> MESSAGE_XYZ = uuid.UUID('" SD_ID128_FORMAT_STR "')\n", + SD_ID128_FORMAT_VAL(id)); return 0; } |