1 /* 2 ** OSSP uuid - Universally Unique Identifier 3 ** Copyright (c) 2004-2008 Ralf S. Engelschall <rse@engelschall.com> 4 ** Copyright (c) 2004-2008 The OSSP Project <http://www.ossp.org/> 5 ** 6 ** This file is part of OSSP uuid, a library for the generation 7 ** of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/ 8 ** 9 ** Permission to use, copy, modify, and distribute this software for 10 ** any purpose with or without fee is hereby granted, provided that 11 ** the above copyright notice and this permission notice appear in all 12 ** copies. 13 ** 14 ** THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 15 ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 ** MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 ** IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 18 ** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 21 ** USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 ** SUCH DAMAGE. 26 ** 27 ** uuid_str.h: string formatting functions 28 */ 29 30 #ifndef __UUID_STR_H__ 31 #define __UUID_STR_H__ 32 33 #include <stdarg.h> 34 #include <string.h> 35 36 #define STR_PREFIX uuid_ 37 38 /* embedding support */ 39 #ifdef STR_PREFIX 40 #if defined(__STDC__) || defined(__cplusplus) 41 #define __STR_CONCAT(x,y) x ## y 42 #define STR_CONCAT(x,y) __STR_CONCAT(x,y) 43 #else 44 #define __STR_CONCAT(x) x 45 #define STR_CONCAT(x,y) __STR_CONCAT(x)y 46 #endif 47 #define str_vsnprintf STR_CONCAT(STR_PREFIX,str_vsnprintf) 48 #define str_snprintf STR_CONCAT(STR_PREFIX,str_snprintf) 49 #define str_vrsprintf STR_CONCAT(STR_PREFIX,str_vrsprintf) 50 #define str_rsprintf STR_CONCAT(STR_PREFIX,str_rsprintf) 51 #define str_vasprintf STR_CONCAT(STR_PREFIX,str_vasprintf) 52 #define str_asprintf STR_CONCAT(STR_PREFIX,str_asprintf) 53 #endif 54 55 extern int str_vsnprintf (char *, size_t, const char *, va_list); 56 extern int str_snprintf (char *, size_t, const char *, ...); 57 extern int str_vrsprintf (char **, const char *, va_list); 58 extern int str_rsprintf (char **, const char *, ...); 59 extern char *str_vasprintf ( const char *, va_list); 60 extern char *str_asprintf ( const char *, ...); 61 62 #endif /* __UUID_STR_H__ */ 63 64