Index: ossp-pkg/uuid/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v rcsdiff -q -kk '-r1.41' '-r1.42' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v' 2>/dev/null --- ChangeLog 2004/02/13 16:01:23 1.41 +++ ChangeLog 2004/02/13 16:17:07 1.42 @@ -11,7 +11,11 @@ This is a list of all changes to OSSP uuid. For a more brief summary please have a look at the NEWS file. - Changes between 0.9.5 and 0.9.6 (06-Feb-2004 to 13-Feb-2004) + Changes between 0.9.6 and 0.9.7 (11-Feb-2004 to 13-Feb-2004) + + o Add support to uuid(1) CLI for decoding from stdin for + both binary and string representations. + [Ralf S. Engelschall] o Add missing documentation entries for UUID_XXXX API constants and uuid_version() function. @@ -28,6 +32,8 @@ o Fixed "uuid -h" command. [] + Changes between 0.9.5 and 0.9.6 (06-Feb-2004 to 11-Feb-2004) + o Added an experimental additional DCE 1.1 API for backward compatibility with existing applications. [Ralf S. Engelschall] Index: ossp-pkg/uuid/uuid_cli.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_cli.c,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_cli.c,v' 2>/dev/null --- uuid_cli.c 2004/02/13 14:29:32 1.15 +++ uuid_cli.c 2004/02/13 16:17:07 1.16 @@ -71,6 +71,8 @@ /* main procedure */ int main(int argc, char *argv[]) { + char uuid_buf_bin[UUID_LEN_BIN]; + char uuid_buf_str[UUID_LEN_STR+1]; uuid_t *uuid; uuid_t *uuid_ns; uuid_rc_t rc; @@ -147,14 +149,33 @@ if (decode) { /* decoding */ - if (argc != 1) - usage("invalid number of arguments"); if ((rc = uuid_create(&uuid)) != UUID_RC_OK) error(1, "uuid_create: %s", uuid_error(rc)); - if (strlen(argv[0]) != UUID_LEN_STR) - error(1, "invalid length of UUID string representation"); - if ((rc = uuid_import(uuid, UUID_FMT_STR, argv[0], strlen(argv[0]))) != UUID_RC_OK) - error(1, "uuid_import: %s", uuid_error(rc)); + if (argc != 1) + usage("invalid number of arguments"); + if (strcmp(argv[0], "-") == 0) { + if (raw) { + if (fread(uuid_buf_bin, UUID_LEN_BIN, 1, stdin) != 1) + error(1, "fread: failed to read %d (UUID_LEN_BIN) bytes from stdin", UUID_LEN_BIN); + if ((rc = uuid_import(uuid, UUID_FMT_BIN, uuid_buf_bin, UUID_LEN_BIN)) != UUID_RC_OK) + error(1, "uuid_import: %s", uuid_error(rc)); + } + else { + if (fread(uuid_buf_str, UUID_LEN_STR, 1, stdin) != 1) + error(1, "fread: failed to read %d (UUID_LEN_STR) bytes from stdin", UUID_LEN_STR); + uuid_buf_str[UUID_LEN_STR] = '\0'; + if ((rc = uuid_import(uuid, UUID_FMT_STR, uuid_buf_str, UUID_LEN_STR)) != UUID_RC_OK) + error(1, "uuid_import: %s", uuid_error(rc)); + } + } + else { + if (raw) + error(1, "raw input mode only possible if reading from stdin"); + if (strlen(argv[0]) != UUID_LEN_STR) + error(1, "invalid length of UUID string representation"); + if ((rc = uuid_import(uuid, UUID_FMT_STR, argv[0], strlen(argv[0]))) != UUID_RC_OK) + error(1, "uuid_import: %s", uuid_error(rc)); + } vp = NULL; if ((rc = uuid_export(uuid, UUID_FMT_TXT, &vp, NULL)) != UUID_RC_OK) error(1, "uuid_export: %s", uuid_error(rc)); Index: ossp-pkg/uuid/uuid_cli.pod RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_cli.pod,v rcsdiff -q -kk '-r1.14' '-r1.15' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_cli.pod,v' 2>/dev/null --- uuid_cli.pod 2004/02/13 14:29:32 1.14 +++ uuid_cli.pod 2004/02/13 16:17:07 1.15 @@ -121,8 +121,9 @@ =item B<-d> -Decode a given UUID (either on F or as an argument on the command -line) and dump textual information about the UUID. +Decode a given UUID (given as a command line argument or if the command +line argument is "C<->" the UUID is read from F) and dump textual +information about the UUID. =back