head 1.6; access; symbols STR_0_9_12:1.6 LMTP2NNTP_1_4_1:1.6 LMTP2NNTP_1_4_0:1.6 STR_0_9_11:1.6 STR_0_9_10:1.6 LMTP2NNTP_1_3_0:1.5 LMTP2NNTP_1_3b2:1.5 LMTP2NNTP_1_3b1:1.5 LMTP2NNTP_1_3a3:1.5 LMTP2NNTP_1_3a2:1.5 STR_0_9_9:1.5 LMTP2NNTP_1_3a1:1.5 STR_0_9_8:1.5 LMTP2NNTP_1_2_0:1.5 LMTP2NNTP_1_2b4:1.5 LMTP2NNTP_1_2b3:1.5 LMTP2NNTP_1_2b2:1.5 LMTP2NNTP_1_2b1:1.5 LMTP2NNTP_1_2a8:1.5 LMTP2NNTP_1_2a7:1.5 LMTP2NNTP_1_2a6:1.4 LMTP2NNTP_1_2a5:1.4 STR_0_9_7:1.4 LMTP2NNTP_1_2a4:1.3 LMTP2NNTP_1_2a3:1.3 OSSP_RC_SPEC:1.3 LMTP2NNTP_1_2a1:1.2 LMTP2NNTP_1_1_1:1.2 LMTP2NNTP_1_1_0:1.2 LMTP2NNTP_1_1b4:1.2 LMTP2NNTP_1_1b3:1.2 LMTP2NNTP_1_1b2:1.2 LMTP2NNTP_1_1b1:1.2 STR_0_9_6:1.2; locks; strict; comment @# @; 1.6 date 2005.01.24.15.22.19; author rse; state Exp; branches; next 1.5; 1.5 date 2003.01.06.19.13.47; author rse; state Exp; branches; next 1.4; 1.4 date 2002.04.01.08.32.54; author rse; state Exp; branches; next 1.3; 1.3 date 2002.01.02.17.09.13; author rse; state Exp; branches; next 1.2; 1.2 date 2001.09.10.10.14.38; author thl; state Exp; branches; next 1.1; 1.1 date 2001.09.10.09.55.13; author thl; state Exp; branches; next ; desc @@ 1.6 log @Adjusted copyright messages for new year 2004/2005. @ text @/* ** OSSP str - String Handling ** Copyright (c) 1999-2005 Ralf S. Engelschall ** Copyright (c) 1999-2005 The OSSP Project ** ** This file is part of OSSP str, a string handling and manipulation ** library which can be found at http://www.ossp.org/pkg/lib/str/. ** ** 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. ** ** str.h: public API header */ #ifndef _STR_H_ #define _STR_H_ /* C++ support */ #ifdef __cplusplus #define BEGIN_DECLARATION extern "C" { #define END_DECLARATION } #else #define BEGIN_DECLARATION /*nop*/ #define END_DECLARATION /*nop*/ #endif /* version information (compile-time) */ #define STR_VERSION_STR "@@STR_VERSION_STR@@" #define STR_VERSION_HEX @@STR_VERSION_HEX@@ /* version information (run-time) */ typedef struct { const int v_hex; const char *v_short; const char *v_long; const char *v_tex; const char *v_gnu; const char *v_web; const char *v_sccs; const char *v_rcs; } str_version_t; extern str_version_t str_version; #include #include #include #include /* true and false boolean values and corresponding type */ #undef TRUE #undef FALSE #undef BOOL #ifdef __cplusplus #define BOOL bool #define TRUE true #define FALSE false #else #define BOOL char #define TRUE ((BOOL)(1 == 1)) #define FALSE ((BOOL)(0 == 1)) #endif /* null values for pointers and characters */ #ifndef NULL #define NULL ((void *)0) #endif #ifndef NUL #define NUL '\0' #endif BEGIN_DECLARATION typedef unsigned int str_size_t; #define STR_RIGHT (1 << 0) /* operate from right end */ #define STR_COMPLEMENT (1 << 1) /* use complement */ #define STR_NOCASE (1 << 2) /* no case sensitive operation */ #define STR_STRIPQUOTES (1 << 3) /* strip quote characters */ #define STR_BACKSLASHESC (1 << 4) /* enable ANSI C style (backslashed) escape sequences */ #define STR_SKIPDELIMS (1 << 5) /* skip trailing delimiters before return */ #define STR_TRIGRAPHS (1 << 6) /* enable ANSI C trigraph processing (implies STR_BACKSLASHESCAPE) */ #define STR_HASH_DJBX33 (1 << 0) /* Daniel J. Bernstein: Times 33 */ #define STR_HASH_BJDDJ (1 << 1) /* Bob Jenkins: Dr. Dobbs Journal */ #define STR_HASH_MACRC32 (1 << 2) /* Mark Adler: Cyclic Redudancy Check 32 */ #define STR_BASE64_ENCODE (1 << 0) /* encode: string -> base64 */ #define STR_BASE64_DECODE (1 << 1) /* decode: base64 -> string */ #define STR_BASE64_STRICT (1 << 2) /* strict encoding with no more than 72 chars/line */ extern str_size_t str_len (const char *); extern char *str_copy (char *, const char *, str_size_t); extern char *str_dup (const char *, str_size_t); extern char *str_concat (char *, ...); extern char *str_splice (char *, str_size_t, str_size_t, char *, str_size_t); extern char *str_token (char **, const char *, const char *, const char *, int); extern int str_parse (const char *, const char *, ...); extern int str_compare (const char *, const char *, str_size_t, int); extern char *str_span (const char *, str_size_t, const char *, int); extern char *str_locate (const char *, str_size_t, const char *); extern int str_format (char *, str_size_t, const char *, ...); extern unsigned long str_hash (const char *, str_size_t, int); extern int str_base64 (char *, str_size_t, unsigned char *, str_size_t, int); extern char *str_concat_va (char *, va_list); extern int str_parse_va (const char *, const char *, va_list); extern int str_format_va (char *, str_size_t, const char *, va_list); END_DECLARATION #endif /* _STR_H_ */ @ 1.5 log @- adjust copyright messages for new year 2003 - strip trailing whitespaces - consistently use OSSP ASCII-art - add standard devtool.conf stuff from OSSP sa @ text @d3 2 a4 2 ** Copyright (c) 1999-2003 Ralf S. Engelschall ** Copyright (c) 1999-2003 The OSSP Project @ 1.4 log @finally switch to full OSSP branding @ text @d3 2 a4 2 ** Copyright (c) 1999-2002 Ralf S. Engelschall ** Copyright (c) 1999-2002 The OSSP Project d6 1 a6 1 ** This file is part of OSSP str, a string handling and manipulation d99 1 a99 1 #define STR_HASH_BJDDJ (1 << 1) /* Bob Jenkins: Dr. Dobbs Journal */ @ 1.3 log @bump copyright year @ text @d2 1 a2 1 ** Str - String Library d4 1 d6 2 a7 2 ** This file is part of Str, a string handling and manipulation ** library which can be found at http://www.engelschall.com/sw/str/. @ 1.2 log @add also run-time version information to public API @ text @d3 1 a3 1 ** Copyright (c) 1999-2001 Ralf S. Engelschall @ 1.1 log @add library version to public API @ text @d41 1 d44 13 @