Index: ossp-pkg/uuid/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v rcsdiff -q -kk '-r1.104' '-r1.105' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v' 2>/dev/null --- ChangeLog 2006/01/15 18:40:36 1.104 +++ ChangeLog 2006/02/07 08:19:14 1.105 @@ -11,6 +11,13 @@ 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 1.4.0 and 1.4.1 (15-Jan-2006 to 07-Feb-2006) + + o Apply workaround to uuid.h to avoid conflicts with + vendor UUID implementations where uuid_t (Darwin/MacOSX) + or uuid_create/uuid_compare (POSIX) might exist. + [Ralf S. Engelschall] + Changes between 1.3.2 and 1.4.0 (06-Dec-2005 to 15-Jan-2006) o Created a top-level Perl ExtUtils::MakeMaker wrapper script Index: ossp-pkg/uuid/perl/uuid.xs RCS File: /v/ossp/cvs/ossp-pkg/uuid/perl/Attic/uuid.xs,v rcsdiff -q -kk '-r1.5' '-r1.6' -u '/v/ossp/cvs/ossp-pkg/uuid/perl/Attic/uuid.xs,v' 2>/dev/null --- uuid.xs 2006/01/13 06:44:33 1.5 +++ uuid.xs 2006/02/07 08:19:15 1.6 @@ -27,12 +27,12 @@ ** uuid.xs: Perl Binding (Perl/XS part) */ +#include "uuid.h" + #include "EXTERN.h" #include "perl.h" #include "XSUB.h" -#include "uuid.h" - MODULE = OSSP::uuid PACKAGE = OSSP::uuid void Index: ossp-pkg/uuid/pgsql/uuid.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/pgsql/Attic/uuid.c,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/uuid/pgsql/Attic/uuid.c,v' 2>/dev/null --- uuid.c 2006/01/13 06:44:34 1.2 +++ uuid.c 2006/02/07 08:19:15 1.3 @@ -27,6 +27,9 @@ ** uuid.c: PostgreSQL Binding (C part) */ +/* own headers */ +#include "uuid.h" + /* PostgreSQL (part 1/2) headers */ #include "postgres.h" @@ -37,9 +40,6 @@ #include "fmgr.h" #include "lib/stringinfo.h" -/* own headers */ -#include "uuid.h" - /* internal UUID datum data structure */ typedef struct { char uuid_bin[UUID_LEN_BIN]; Index: ossp-pkg/uuid/php/uuid.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/php/Attic/uuid.c,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/uuid/php/Attic/uuid.c,v' 2>/dev/null --- uuid.c 2006/01/13 06:44:34 1.4 +++ uuid.c 2006/02/07 08:19:16 1.5 @@ -31,9 +31,9 @@ #include "config.h" #endif +#include "uuid.h" #include "php.h" #include "ext/standard/info.h" -#include "uuid.h" /* context structure */ typedef struct { Index: ossp-pkg/uuid/uuid.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.c,v rcsdiff -q -kk '-r1.57' '-r1.58' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.c,v' 2>/dev/null --- uuid.c 2006/01/13 06:44:30 1.57 +++ uuid.c 2006/02/07 08:19:15 1.58 @@ -27,6 +27,10 @@ ** uuid.c: library API implementation */ +/* own headers (part 1/2) */ +#include "config.h" +#include "uuid.h" + /* system headers */ #include #include @@ -39,9 +43,7 @@ #include #include -/* own headers */ -#include "config.h" -#include "uuid.h" +/* own headers (part 2/2) */ #include "uuid_vers.h" #include "uuid_md5.h" #include "uuid_sha1.h" Index: ossp-pkg/uuid/uuid.h.in RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.h.in,v co -q -kk -p'1.11' '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.h.in,v' | diff -u /dev/null - -L'ossp-pkg/uuid/uuid.h.in' 2>/dev/null --- ossp-pkg/uuid/uuid.h.in +++ - 2024-05-17 19:29:32.614329989 +0200 @@ -0,0 +1,118 @@ +/* +** OSSP uuid - Universally Unique Identifier +** Copyright (c) 2004-2006 Ralf S. Engelschall +** Copyright (c) 2004-2006 The OSSP Project +** +** This file is part of OSSP uuid, a library for the generation +** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ +** +** Permission to use, copy, modify, and distribute this software for +** any purpose with or without fee is hereby granted, provided that +** the above copyright notice and this permission notice appear in all +** copies. +** +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +** +** uuid.h: library API definition +*/ + +#ifndef __UUID_H__ +#define __UUID_H__ + +/* workaround conflicts with system headers */ +#define uuid_t __vendor_uuid_t +#define uuid_create __vendor_uuid_create +#define uuid_compare __vendor_uuid_compare +#include +#include +#undef uuid_t +#undef uuid_create +#undef uuid_compare + +/* required system headers */ +#include + +/* minimum C++ support */ +#ifdef __cplusplus +#define DECLARATION_BEGIN extern "C" { +#define DECLARATION_END } +#else +#define DECLARATION_BEGIN +#define DECLARATION_END +#endif + +DECLARATION_BEGIN + +/* OSSP uuid version (compile-time information) */ +#define UUID_VERSION @UUID_VERSION_HEX@ + +/* encoding octet stream lengths */ +#define UUID_LEN_BIN (128 /*bit*/ / 8 /*bytes*/) +#define UUID_LEN_STR (128 /*bit*/ / 4 /*nibbles*/ + 4 /*hyphens*/) + +/* API return codes */ +typedef enum { + UUID_RC_OK = 0, /* everything ok */ + UUID_RC_ARG = 1, /* invalid argument */ + UUID_RC_MEM = 2, /* out of memory */ + UUID_RC_SYS = 3, /* system error */ + UUID_RC_INT = 4, /* internal error */ + UUID_RC_IMP = 5 /* not implemented */ +} uuid_rc_t; + +/* UUID make modes */ +enum { + UUID_MAKE_V1 = (1 << 0), /* DCE 1.1 v1 UUID */ + UUID_MAKE_V3 = (1 << 1), /* DCE 1.1 v3 UUID */ + UUID_MAKE_V4 = (1 << 2), /* DCE 1.1 v4 UUID */ + UUID_MAKE_V5 = (1 << 3), /* DCE 1.1 v5 UUID */ + UUID_MAKE_MC = (1 << 4) /* enforce multi-cast MAC address */ +}; + +/* UUID import/export formats */ +typedef enum { + UUID_FMT_BIN = 0, /* binary representation (import/export) */ + UUID_FMT_STR = 1, /* string representation (import/export) */ + UUID_FMT_TXT = 2 /* textual description (export only) */ +} uuid_fmt_t; + +/* UUID abstract data type */ +struct uuid_st; +typedef struct uuid_st uuid_t; + +/* UUID object handling */ +extern uuid_rc_t uuid_create ( uuid_t **_uuid); +extern uuid_rc_t uuid_destroy ( uuid_t *_uuid); +extern uuid_rc_t uuid_clone (const uuid_t *_uuid, uuid_t **_clone); + +/* UUID generation */ +extern uuid_rc_t uuid_load ( uuid_t *_uuid, const char *_name); +extern uuid_rc_t uuid_make ( uuid_t *_uuid, unsigned int _mode, ...); + +/* UUID comparison */ +extern uuid_rc_t uuid_isnil (const uuid_t *_uuid, int *_result); +extern uuid_rc_t uuid_compare (const uuid_t *_uuid, const uuid_t *_uuid2, int *_result); + +/* UUID import/export */ +extern uuid_rc_t uuid_import ( uuid_t *_uuid, uuid_fmt_t _fmt, const void *_data_ptr, size_t _data_len); +extern uuid_rc_t uuid_export (const uuid_t *_uuid, uuid_fmt_t _fmt, void **_data_ptr, size_t *_data_len); + +/* library utilities */ +extern char *uuid_error (uuid_rc_t _rc); +extern unsigned long uuid_version (void); + +DECLARATION_END + +#endif /* __UUID_H__ */ + Index: ossp-pkg/uuid/uuid_cli.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_cli.c,v co -q -kk -p'1.21' '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid_cli.c,v' | diff -u /dev/null - -L'ossp-pkg/uuid/uuid_cli.c' 2>/dev/null --- ossp-pkg/uuid/uuid_cli.c +++ - 2024-05-17 19:29:32.616990784 +0200 @@ -0,0 +1,250 @@ +/* +** OSSP uuid - Universally Unique Identifier +** Copyright (c) 2004-2006 Ralf S. Engelschall +** Copyright (c) 2004-2006 The OSSP Project +** +** This file is part of OSSP uuid, a library for the generation +** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ +** +** Permission to use, copy, modify, and distribute this software for +** any purpose with or without fee is hereby granted, provided that +** the above copyright notice and this permission notice appear in all +** copies. +** +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +** +** uuid_cli.c: command line tool +*/ + +#include "uuid.h" + +#include +#include +#include +#include +#include +#include + +/* error handler */ +static void +error(int ec, const char *str, ...) +{ + va_list ap; + + va_start(ap, str); + fprintf(stderr, "uuid:ERROR: "); + vfprintf(stderr, str, ap); + fprintf(stderr, "\n"); + va_end(ap); + exit(ec); +} + +/* usage handler */ +static void +usage(const char *str, ...) +{ + va_list ap; + + va_start(ap, str); + if (str != NULL) { + fprintf(stderr, "uuid:ERROR: "); + vfprintf(stderr, str, ap); + fprintf(stderr, "\n"); + } + fprintf(stderr, "usage: uuid [-v version] [-m] [-n count] [-1] [-r] [-o filename] [namespace name]\n"); + fprintf(stderr, "usage: uuid -d [-r] [-o filename] [uuid]\n"); + va_end(ap); + exit(1); +} + +/* 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; + FILE *fp; + char *p; + int ch; + int count; + int i; + int iterate; + int raw; + int decode; + void *vp; + size_t n; + unsigned int version; + + /* command line parsing */ + count = -1; /* no count yet */ + fp = stdout; /* default output file */ + iterate = 0; /* not one at a time */ + raw = 0; /* default is ASCII output */ + decode = 0; /* default is to encode */ + version = UUID_MAKE_V1; + while ((ch = getopt(argc, argv, "1n:rdmo:v:h")) != -1) { + switch (ch) { + case '1': + iterate = 1; + break; + case 'n': + if (count > 0) + usage("option 'n' specified multiple times"); + count = strtol(optarg, &p, 10); + if (*p != '\0' || count < 1) + usage("invalid argument to option 'n'"); + break; + case 'r': + raw = 1; + break; + case 'd': + decode = 1; + break; + case 'o': + if (fp != stdout) + error(1, "multiple output files are not allowed"); + if ((fp = fopen(optarg, "w")) == NULL) + error(1, "fopen: %s", strerror(errno)); + break; + case 'm': + version |= UUID_MAKE_MC; + break; + case 'v': + i = strtol(optarg, &p, 10); + if (*p != '\0') + usage("invalid argument to option 'v'"); + switch (i) { + case 1: version = UUID_MAKE_V1; break; + case 3: version = UUID_MAKE_V3; break; + case 4: version = UUID_MAKE_V4; break; + case 5: version = UUID_MAKE_V5; break; + default: + usage("invalid version on option 'v'"); + break; + } + break; + case 'h': + usage(NULL); + break; + default: + usage("invalid option '%c'", optopt); + } + } + argv += optind; + argc -= optind; + if (count == -1) + count = 1; + + if (decode) { + /* decoding */ + if ((rc = uuid_create(&uuid)) != UUID_RC_OK) + error(1, "uuid_create: %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)); + fprintf(stdout, "%s", (char *)vp); + free(vp); + if ((rc = uuid_destroy(uuid)) != UUID_RC_OK) + error(1, "uuid_destroy: %s", uuid_error(rc)); + } + else { + /* encoding */ + if ( (version == UUID_MAKE_V1 && argc != 0) + || (version == UUID_MAKE_V3 && argc != 2) + || (version == UUID_MAKE_V4 && argc != 0) + || (version == UUID_MAKE_V5 && argc != 2)) + usage("invalid number of arguments"); + if ((rc = uuid_create(&uuid)) != UUID_RC_OK) + error(1, "uuid_create: %s", uuid_error(rc)); + if (argc == 1) { + /* load initial UUID for setting old generator state */ + 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)); + } + for (i = 0; i < count; i++) { + if (iterate) { + if ((rc = uuid_load(uuid, "nil")) != UUID_RC_OK) + error(1, "uuid_load: %s", uuid_error(rc)); + } + if (version == UUID_MAKE_V3 || version == UUID_MAKE_V5) { + if ((rc = uuid_create(&uuid_ns)) != UUID_RC_OK) + error(1, "uuid_create: %s", uuid_error(rc)); + if ((rc = uuid_load(uuid_ns, argv[0])) != UUID_RC_OK) { + if ((rc = uuid_import(uuid_ns, UUID_FMT_STR, argv[0], strlen(argv[0]))) != UUID_RC_OK) + error(1, "uuid_import: %s", uuid_error(rc)); + } + if ((rc = uuid_make(uuid, version, uuid_ns, argv[1])) != UUID_RC_OK) + error(1, "uuid_make: %s", uuid_error(rc)); + if ((rc = uuid_destroy(uuid_ns)) != UUID_RC_OK) + error(1, "uuid_destroy: %s", uuid_error(rc)); + } + else { + if ((rc = uuid_make(uuid, version)) != UUID_RC_OK) + error(1, "uuid_make: %s", uuid_error(rc)); + } + if (raw) { + vp = NULL; + if ((rc = uuid_export(uuid, UUID_FMT_BIN, &vp, &n)) != UUID_RC_OK) + error(1, "uuid_export: %s", uuid_error(rc)); + fwrite(vp, n, 1, fp); + free(vp); + } + else { + vp = NULL; + if ((rc = uuid_export(uuid, UUID_FMT_STR, &vp, &n)) != UUID_RC_OK) + error(1, "uuid_export: %s", uuid_error(rc)); + fprintf(fp, "%s\n", (char *)vp); + free(vp); + } + } + if ((rc = uuid_destroy(uuid)) != UUID_RC_OK) + error(1, "uuid_destroy: %s", uuid_error(rc)); + } + + /* close output channel */ + if (fp != stdout) + fclose(fp); + + return 0; +} +