Index: ossp-pkg/str/AUTHORS RCS File: /v/ossp/cvs/ossp-pkg/str/AUTHORS,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/str/AUTHORS,v' 2>/dev/null --- AUTHORS 2002/04/01 08:32:54 1.7 +++ AUTHORS 2003/01/06 19:13:47 1.8 @@ -1,15 +1,15 @@ - ____ _ - / ___|| |_ _ __ - \___ \| __| '__| - ___) | |_| | - |____/ \__|_| - - OSSP str - String Handling + _ ___ ____ ____ ____ _ + |_|_ _ / _ \/ ___/ ___|| _ \ ___| |_ _ __ + _|_||_| | | | \___ \___ \| |_) | / __| __| '__| + |_||_|_| | |_| |___) |__) | __/ \__ \ |_| | + |_|_|_| \___/|____/____/|_| |___/\__|_| + + OSSP str - String Handling ____________________________________________________________________ AUTHORS - This is a list of authors who have written or edited parts of + This is a list of authors who have written or edited parts of the Str sources. o Str (as a whole) @@ -21,7 +21,7 @@ Written by: Ralf S. Engelschall Parts by: University of California Berkeley Edited by: Ralf S. Engelschall - + o str_token.c: Written by: Ralf S. Engelschall Parts by: William Deich @@ -39,7 +39,7 @@ o str_base64.c: Written by: Ralf S. Engelschall - Parts by: Internet Software Consortium (ISC), + Parts by: Internet Software Consortium (ISC), International Business Machines (IBM) Edited by: Ralf S. Engelschall Index: ossp-pkg/str/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/str/ChangeLog,v rcsdiff -q -kk '-r1.41' '-r1.42' -u '/v/ossp/cvs/ossp-pkg/str/ChangeLog,v' 2>/dev/null --- ChangeLog 2002/04/01 09:50:23 1.41 +++ ChangeLog 2003/01/06 19:13:47 1.42 @@ -1,14 +1,23 @@ - ____ _ - / ___|| |_ _ __ - \___ \| __| '__| - ___) | |_| | - |____/ \__|_| - - OSSP str - String Handling + _ ___ ____ ____ ____ _ + |_|_ _ / _ \/ ___/ ___|| _ \ ___| |_ _ __ + _|_||_| | | | \___ \___ \| |_) | / __| __| '__| + |_||_|_| | |_| |___) |__) | __/ \__ \ |_| | + |_|_|_| \___/|____/____/|_| |___/\__|_| + + OSSP str - String Handling ____________________________________________________________________ ChangeLog + Changes between 0.9.7 and 0.9.8 (01-Apr-2002 to xx-Jan-2003): + + *) Upgraded to GNU autoconf 2.57, GNU libtool 1.4.3 and + GNU shtool 1.6.2 build environment. + [Ralf S. Engelschall] + + *) Adjusted copyright messages for new year 2003. + [Ralf S. Engelschall] + Changes between 0.9.6 and 0.9.7 (28-Dec-2001 to 01-Apr-2002): *) Use OSSP ts (Test Suite) sub-library for "make check". @@ -18,11 +27,11 @@ location from engelschall.com to ossp.org. [Ralf S. Engelschall] - *) Upgraded to GNU autoconf 2.53, GNU libtool 1.4.2 and + *) Upgraded to GNU autoconf 2.53, GNU libtool 1.4.2 and GNU shtool 1.6.0 build environment. [Ralf S. Engelschall] - *) Fixed str_concat: it included the terminating NUL in copy + *) Fixed str_concat: it included the terminating NUL in copy and added a useless NUL. [Thomas Lotterer] @@ -47,13 +56,13 @@ [Ralf S. Engelschall] Changes between 0.9.4 and 0.9.5 (14-Jul-2000 to 16-Aug-2001): - - *) Fix return code documentation of str_parse(): it -1 (error), 0 + + *) Fix return code documentation of str_parse(): it -1 (error), 0 (no matching) or +1 (matching) and not just TRUE or FALSE. Additionally fixed the str_parse() examples in the documentation. [Ralf S. Engelschall, Thomas Lotterer] - *) Let str_base64(STR_BASE64_DECODE, ...) correctly honor + *) Let str_base64(STR_BASE64_DECODE, ...) correctly honor the specified maximum size of the input string. [Peter Simons ] @@ -66,7 +75,7 @@ *) Upgrade to GNU shtool 1.5.4. [Ralf S. Engelschall] - *) Fixed handling of NaN and Inf values in str_format.c + *) Fixed handling of NaN and Inf values in str_format.c [Lukas Schroeder ] *) Fix unsigned vs. signed problem in str_span.c. @@ -84,7 +93,7 @@ [Ed Griffiths , Ralf S. Engelschall] *) Avoid isupper() check in str_tolower() macro, because it - breaks for things like str_tolower(*s++). + breaks for things like str_tolower(*s++). This fixes especially str_compare(...,...,STR_NOCASE). [Kai Poitschke ] @@ -103,7 +112,7 @@ [Ralf S. Engelschall] Changes between 0.9.1 and 0.9.2 (09-Jan-2000 to 04-Feb-2000): - + *) Added three function variants with va_list support: str_parse_va, str_concat_va and str_format_va. Each str_xxx_va function is the same as the str_xxx function except that it can be called with a va_list Index: ossp-pkg/str/INSTALL RCS File: /v/ossp/cvs/ossp-pkg/str/INSTALL,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/str/INSTALL,v' 2>/dev/null --- INSTALL 2002/04/01 08:32:54 1.2 +++ INSTALL 2003/01/06 19:13:47 1.3 @@ -1,16 +1,16 @@ - ____ _ - / ___|| |_ _ __ + ____ _ + / ___|| |_ _ __ \___ \| __| '__| - ___) | |_| | - |____/ \__|_| - - OSSP str - String Handling + ___) | |_| | + |____/ \__|_| + + OSSP str - String Handling INSTALL To install the Str library into /path/to/str/{bin,lib,include,man}/ perform the following steps in your shell: - + $ ./configure --prefix=/path/to/str $ make $ make test Index: ossp-pkg/str/LICENSE RCS File: /v/ossp/cvs/ossp-pkg/str/LICENSE,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/str/LICENSE,v' 2>/dev/null --- LICENSE 2002/04/01 08:32:54 1.4 +++ LICENSE 2003/01/06 19:13:47 1.5 @@ -1,8 +1,8 @@ OSSP str - String Handling - Copyright (c) 1999-2002 Ralf S. Engelschall - Copyright (c) 1999-2002 The OSSP Project + Copyright (c) 1999-2003 Ralf S. Engelschall + Copyright (c) 1999-2003 The OSSP Project Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that Index: ossp-pkg/str/Makefile.in RCS File: /v/ossp/cvs/ossp-pkg/str/Makefile.in,v rcsdiff -q -kk '-r1.45' '-r1.46' -u '/v/ossp/cvs/ossp-pkg/str/Makefile.in,v' 2>/dev/null --- Makefile.in 2002/04/01 09:03:49 1.45 +++ Makefile.in 2003/01/06 19:13:47 1.46 @@ -1,9 +1,9 @@ ## ## OSSP str - String Handling -## Copyright (c) 1999-2002 Ralf S. Engelschall -## Copyright (c) 1999-2002 The OSSP Project +## Copyright (c) 1999-2003 Ralf S. Engelschall +## Copyright (c) 1999-2003 The OSSP Project ## -## This file is part of OSSP str, a string handling and manipulation +## 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 @@ -100,7 +100,7 @@ $(OBJS): Makefile -libstr.la: $(OBJS) +libstr.la: $(OBJS) $(LIBTOOL) --mode=link --quiet $(CC) -o libstr.la $(OBJS) -rpath $(libdir) \ -version-info `$(SHTOOL) version -l c -d libtool str_version.c` @@ -143,7 +143,7 @@ $(RM) str_test.o str_test $(RM) libstr.la $(RM) -r .libs - + distclean: clean $(RM) str-config $(RM) config.h Index: ossp-pkg/str/README RCS File: /v/ossp/cvs/ossp-pkg/str/README,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/str/README,v' 2>/dev/null --- README 2002/04/01 09:12:13 1.19 +++ README 2003/01/06 19:13:47 1.20 @@ -1,11 +1,11 @@ - ____ _ - / ___|| |_ _ __ - \___ \| __| '__| - ___) | |_| | - |____/ \__|_| - - OSSP str - String Handling - Version 0.9.6 (13-Sep-2001) + _ ___ ____ ____ ____ _ + |_|_ _ / _ \/ ___/ ___|| _ \ ___| |_ _ __ + _|_||_| | | | \___ \___ \| |_) | / __| __| '__| + |_||_|_| | |_| |___) |__) | __/ \__ \ |_| | + |_|_|_| \___/|____/____/|_| |___/\__|_| + + OSSP str - String Handling + Version 0.9.8 (06-Jan-2003) ABSTRACT @@ -17,8 +17,8 @@ COPYRIGHT AND LICENSE - Copyright (c) 1999-2002 Ralf S. Engelschall - Copyright (c) 1999-2002 The OSSP Project + Copyright (c) 1999-2003 Ralf S. Engelschall + Copyright (c) 1999-2003 The OSSP Project This product includes software developed by the University of California, Berkeley and its contributors. This product includes Index: ossp-pkg/str/THANKS RCS File: /v/ossp/cvs/ossp-pkg/str/THANKS,v rcsdiff -q -kk '-r1.8' '-r1.9' -u '/v/ossp/cvs/ossp-pkg/str/THANKS,v' 2>/dev/null --- THANKS 2002/04/01 08:32:54 1.8 +++ THANKS 2003/01/06 19:13:47 1.9 @@ -1,12 +1,12 @@ - ____ _ - / ___|| |_ _ __ - \___ \| __| '__| - ___) | |_| | - |____/ \__|_| - - OSSP str - String Handling + _ ___ ____ ____ ____ _ + |_|_ _ / _ \/ ___/ ___|| _ \ ___| |_ _ __ + _|_||_| | | | \___ \___ \| |_) | / __| __| '__| + |_||_|_| | |_| |___) |__) | __/ \__ \ |_| | + |_|_|_| \___/|____/____/|_| |___/\__|_| + + OSSP str - String Handling ____________________________________________________________________ - + THANKS Credit has to be given to the following people who contributed ideas, Index: ossp-pkg/str/TODO RCS File: /v/ossp/cvs/ossp-pkg/str/TODO,v rcsdiff -q -kk '-r1.22' '-r1.23' -u '/v/ossp/cvs/ossp-pkg/str/TODO,v' 2>/dev/null --- TODO 2002/04/01 08:32:54 1.22 +++ TODO 2003/01/06 19:13:47 1.23 @@ -1,10 +1,10 @@ - ____ _ - / ___|| |_ _ __ - \___ \| __| '__| - ___) | |_| | - |____/ \__|_| - - OSSP str - String Handling + _ ___ ____ ____ ____ _ + |_|_ _ / _ \/ ___/ ___|| _ \ ___| |_ _ __ + _|_||_| | | | \___ \___ \| |_) | / __| __| '__| + |_||_|_| | |_| |___) |__) | __/ \__ \ |_| | + |_|_|_| \___/|____/____/|_| |___/\__|_| + + OSSP str - String Handling TODO @@ -12,7 +12,7 @@ o look at ../strnatcmp o dynamic strings o aprintf() variant of str_format (see end of str_format.c!) - + The following *have* to be done before 1.0.0: o perhaps a str_shave() or str_strip() function which @@ -40,7 +40,7 @@ o str_locate could become a "mode" argument which indicates whether "s" is small or large and if it is small a (faster) brute force search could be done. - o str_parse could support s/.../g or even m/.../g + o str_parse could support s/.../g or even m/.../g o one could add "vstr" support with own malloc Dean wrote: have you seen djb's stralloc stuff? it's part of qmail. it looks like a nice way to avoid thinking about lengths. Index: ossp-pkg/str/aclocal.m4 RCS File: /v/ossp/cvs/ossp-pkg/str/aclocal.m4,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/str/aclocal.m4,v' 2>/dev/null --- aclocal.m4 2002/04/01 08:32:54 1.6 +++ aclocal.m4 2003/01/06 19:13:47 1.7 @@ -25,8 +25,8 @@ dnl ## Support for Configuration Headers dnl ## dnl ## configure.in: -dnl ## AC_HEADLINE(, , -dnl ## , , +dnl ## AC_HEADLINE(, , +dnl ## , , dnl ## ) dnl ## @@ -48,7 +48,7 @@ # find out package version $3_STR="`$ac_shtool version -l c -d long $ac_srcdir/$4`" AC_SUBST($3_STR) - + # friendly header ;) if test ".$enable_headline" != .no; then echo "Configuring ${TB}$1${TN} ($2), Version ${TB}${$3_STR}${TN}" Index: ossp-pkg/str/configure.ac RCS File: /v/ossp/cvs/ossp-pkg/str/configure.ac,v rcsdiff -q -kk '-r1.11' '-r1.12' -u '/v/ossp/cvs/ossp-pkg/str/configure.ac,v' 2>/dev/null --- configure.ac 2002/04/01 09:03:49 1.11 +++ configure.ac 2003/01/06 19:13:47 1.12 @@ -7,8 +7,8 @@ AC_HEADLINE(dnl OSSP str, String Handling, dnl STR_VERSION, str_version.c, dnl -[Copyright (c) 1999-2002 Ralf S. Engelschall -Copyright (c) 1999-2002 The OSSP Project ]) +[Copyright (c) 1999-2003 Ralf S. Engelschall +Copyright (c) 1999-2003 The OSSP Project ]) AC_PLATFORM(PLATFORM) AC_PROG_MAKE_SET @@ -26,12 +26,12 @@ AC_CHECK_SIZEOF(long long, 8) AC_CHECK_SIZEOF(void *, 4) -AC_HAVE_FUNCS(memmove memset memcmp memchr) -AC_HAVE_FUNCS(isnan isinf) +AC_HAVE_FUNCS(memmove memset memcmp memchr) +AC_HAVE_FUNCS(isnan isinf) AC_CHECK_FUNC(modf, , AC_CHECK_LIB(m, modf)) -AC_CHECK_EXTLIB([Dmalloc], dmalloc, dmalloc_debug, dmalloc.h, +AC_CHECK_EXTLIB([Dmalloc], dmalloc, dmalloc_debug, dmalloc.h, [AC_DEFINE(WITH_DMALLOC, 1, [Define to 1 if building with Dmalloc])]) AC_CONFIG_HEADERS(config.h) Index: ossp-pkg/str/devtool RCS File: /v/ossp/cvs/ossp-pkg/str/devtool,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/str/devtool,v' 2>/dev/null --- devtool 2002/01/02 17:09:13 1.2 +++ devtool 2003/01/06 19:13:47 1.3 @@ -1,7 +1,7 @@ #!/bin/sh ## ## devtool -- Development Tool -## Copyright (c) 2001-2002 Ralf S. Engelschall +## Copyright (c) 2001-2003 Ralf S. Engelschall ## if [ $# -eq 0 ]; then Index: ossp-pkg/str/devtool.conf RCS File: /v/ossp/cvs/ossp-pkg/str/devtool.conf,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/str/devtool.conf,v' 2>/dev/null --- devtool.conf 2002/07/28 08:07:41 1.3 +++ devtool.conf 2003/01/06 19:13:47 1.4 @@ -3,9 +3,9 @@ ## %autogen - @autogen shtool 1.6.1 "1.6.*" echo install mkdir fixperm tarball version - @autogen libtool 1.4.2 "1.4*" - @autogen autoconf 2.53 "2.5[3-9]*" + @autogen shtool 1.6.2 "1.6.*" echo install mkdir fixperm tarball version + @autogen libtool 1.4.3 "1.4*" + @autogen autoconf 2.57 "2.5[3-9]*" %autoclean @autoclean shtool @@ -21,11 +21,41 @@ %version ./shtool version -l c -n "OSSP str" -p "str_" -e str_version.c + V=`./shtool version -l c -d long str_version.c` + sed -e "s/Version .*/Version $V/g" README.n + mv README.n README %dist - make distclean >/dev/null 2>&1 + rm -f str-*.tar.gz + ./devtool autoclean + ./devtool autogen + ./configure + make clean all man + make distclean ./shtool fixperm -v . V=`./shtool version -l c -d short str_version.c` - ./shtool tarball -o str-${V}.tar.gz -d str-${V} -u ossp -g ossp \ - -e 'CVS,\.cvsignore,\.[ao]$,^\.,devtool.conf' -c 'gzip --best' . + ./shtool tarball -o str-${V}.tar.gz -d str-${V} -u ossp -g str \ + -e 'CVS,\.cvsignore,\.[ao]$,^\.,devtool*' -c 'gzip --best' . + ls -l str-${V}.tar.gz + gunzip /dev/null --- devtool.func 2002/03/14 15:49:51 1.3 +++ devtool.func 2003/01/06 19:13:47 1.4 @@ -1,6 +1,6 @@ ## ## devtool.func -- Development Tool Functions -## Copyright (c) 2001-2002 Ralf S. Engelschall +## Copyright (c) 2001-2003 Ralf S. Engelschall ## devtool_require () { Index: ossp-pkg/str/str-config.in RCS File: /v/ossp/cvs/ossp-pkg/str/str-config.in,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/str/str-config.in,v' 2>/dev/null --- str-config.in 2002/04/01 09:15:37 1.7 +++ str-config.in 2003/01/06 19:13:47 1.8 @@ -1,10 +1,10 @@ #!/bin/sh ## ## OSSP str - String Handling -## Copyright (c) 1999-2002 Ralf S. Engelschall -## Copyright (c) 1999-2002 The OSSP Project +## Copyright (c) 1999-2003 Ralf S. Engelschall +## Copyright (c) 1999-2003 The OSSP Project ## -## This file is part of OSSP str, a string handling and manipulation +## 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 @@ -28,7 +28,7 @@ ## str-config.in: Configuration Tool ## -DIFS=' +DIFS=' ' prefix="@prefix@" Index: ossp-pkg/str/str-config.pod RCS File: /v/ossp/cvs/ossp-pkg/str/str-config.pod,v rcsdiff -q -kk '-r1.5' '-r1.6' -u '/v/ossp/cvs/ossp-pkg/str/str-config.pod,v' 2>/dev/null --- str-config.pod 2002/04/01 08:32:54 1.5 +++ str-config.pod 2003/01/06 19:13:47 1.6 @@ -1,9 +1,9 @@ ## ## OSSP str - String Handling -## Copyright (c) 1999-2002 Ralf S. Engelschall -## Copyright (c) 1999-2002 The OSSP Project +## Copyright (c) 1999-2003 Ralf S. Engelschall +## Copyright (c) 1999-2003 The OSSP Project ## -## This file is part of OSSP str, a string handling and manipulation +## 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 Index: ossp-pkg/str/str.h.in RCS File: /v/ossp/cvs/ossp-pkg/str/str.h.in,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/str/str.h.in,v' 2>/dev/null --- str.h.in 2002/04/01 08:32:54 1.4 +++ str.h.in 2003/01/06 19:13:47 1.5 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -96,7 +96,7 @@ #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_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 */ Index: ossp-pkg/str/str.pod RCS File: /v/ossp/cvs/ossp-pkg/str/str.pod,v rcsdiff -q -kk '-r1.34' '-r1.35' -u '/v/ossp/cvs/ossp-pkg/str/str.pod,v' 2>/dev/null --- str.pod 2002/04/01 09:15:37 1.34 +++ str.pod 2003/01/06 19:13:47 1.35 @@ -1,9 +1,9 @@ ## ## OSSP str - String Handling -## Copyright (c) 1999-2002 Ralf S. Engelschall -## Copyright (c) 1999-2002 The OSSP Project +## Copyright (c) 1999-2003 Ralf S. Engelschall +## Copyright (c) 1999-2003 The OSSP Project ## -## This file is part of OSSP str, a string handling and manipulation +## 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 @@ -177,7 +177,7 @@ This functions searches for the (smaller) string I inside (larger) string I. If I is not C<0>, the search is performed only inside the first I -characters of I. +characters of I. =item char *B(char **I, const char *I, const char *I, const char *I, int I); @@ -209,7 +209,7 @@ used to quote another kind. If an unbalanced quote is found, the function silently act as if one had been placed at the end of the input string. The I and I strings must be disjoint, i.e., they have to share -no characters. +no characters. The I argument can be used to modify the processing of the string (default for I is C<0>): C forces I @@ -396,12 +396,12 @@ =over 4 -=item B `B I I I I*': +=item B `B I I I I*': This matches I against the Perl-style regular expression I under the control of zero or more I which control the parsing semantics. The stripped down I syntax `I' is equivalent to -`BIB'. +`BIB'. For each grouping pair of parenthesis in I, the text in I which was grouped by the parenthesis is extracted into new strings. @@ -409,7 +409,7 @@ caller through following `B' arguments. The caller is required to free(3) them later. -=item B `B I I I I I I*': +=item B `B I I I I I I*': This matches I against the Perl-style regular expression I under the control of zero or more I which control the parsing @@ -688,12 +688,12 @@ char *var = " foo \t " bar 'baz'" q'uu'x #comment"; char *tok, *p; - p = var; + p = var; while ((tok = str_token(p, ":", "\"'", "#", 0)) != NULL) { - /* here we enter three times: + /* here we enter three times: 1. tok = "foo" - 2. tok = " bar 'baz'" - 3. tok = "quux" */ + 2. tok = " bar 'baz'" + 3. tok = "quux" */ ... } @@ -711,7 +711,7 @@ char *cp, *v1, *v2; if (str_parse(var, "m/^(.+?):(.+)$/b", &cp, &v1, &v2) > 0) { ... - /* now we have: + /* now we have: cp = "foo\0bar\0" and v1 and v2 pointing into it, i.e., v1 = "foo", v2 = "bar" */ ... @@ -738,9 +738,9 @@ char *cp; int n; - n = str_format(NULL, 0, "%s|%5s-%x-%04d", v0, v1, v2, v3); + n = str_format(NULL, 0, "%s|%5s-%x-%04d", v0, v1, v2, v3); cp = malloc(n); - str_format(cp, n, "%s-%x-%04d", v1, v2, v3); + str_format(cp, n, "%s-%x-%04d", v1, v2, v3); /* now we have cp = "abc...| foo-DEAD-0042" */ ... free(cp); Index: ossp-pkg/str/str_base64.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_base64.c,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/str/str_base64.c,v' 2>/dev/null --- str_base64.c 2002/04/01 08:32:54 1.6 +++ str_base64.c 2003/01/06 19:13:47 1.7 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -133,7 +133,7 @@ * * Since all base64 input is an integral number of octets, only the * following cases can arise: - * + * * (1) the final quantum of encoding input is an integral * multiple of 24 bits; here, the final unit of encoded * output will be an integral multiple of 4 characters @@ -227,7 +227,7 @@ } /* decoding: base64 -> binary */ -static int +static int base64_decode( unsigned char *dst, str_size_t dstlen, char const *src, str_size_t srclen) Index: ossp-pkg/str/str_basic.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_basic.c,v rcsdiff -q -kk '-r1.11' '-r1.12' -u '/v/ossp/cvs/ossp-pkg/str/str_basic.c,v' 2>/dev/null --- str_basic.c 2002/04/01 08:32:54 1.11 +++ str_basic.c 2003/01/06 19:13:47 1.12 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -29,7 +29,7 @@ #include "str_p.h" -/* +/* * str_len -- determine length of string. * This is exactly equal to POSIX strlen(3). */ @@ -58,12 +58,12 @@ if (as == NULL || at == NULL) return NULL; - if (n == 0) + if (n == 0) n = str_len(at); t = at; s = as; rv = as; - if (s > t) { + if (s > t) { /* must go high to low */ t += n - 1; s += n; @@ -82,9 +82,9 @@ return rv; } -/* +/* * str_dup -- duplicate a string. - * This is inspired by POSIX strdup(3), but provides + * This is inspired by POSIX strdup(3), but provides * the ability to specify a maximum length. */ char *str_dup(const char *s, str_size_t n) @@ -105,7 +105,7 @@ return rv; } -/* +/* * str_concat -- concatenate one or more strings. * This function allows one to concatenate an arbitrary number of * strings and is inspired by Apache's ap_pstrcat() function. @@ -156,9 +156,9 @@ return rv; } -/* +/* * str_splice -- splice one string into another. - * This is inspired by Perl's splice() function and can be used + * This is inspired by Perl's splice() function and can be used * both for inplace movements, insert and cut-out operations. */ char *str_splice(char *s, str_size_t off, str_size_t n, char *t, str_size_t m) @@ -199,7 +199,7 @@ return s; } -/* +/* * str_compare -- compare a two strings. * This is inspired by POSIX str[n][case]cmp(3), but * merges all functionality in a single function. @@ -218,7 +218,7 @@ /* compare case insensitive */ do { if (str_tolower(*s1) != str_tolower(*s2++)) { - rv = ((str_tolower(*s1) - + rv = ((str_tolower(*s1) - str_tolower(*(s2 - 1))) < 0 ? -1 : +1); break; } @@ -231,7 +231,7 @@ /* compare case sensitive */ do { if (*s1 != *s2++) { - rv = (((int)(*(const unsigned char *)s1) - + rv = (((int)(*(const unsigned char *)s1) - (int)(*(const unsigned char *)(s2 - 1))) < 0 ? -1 : +1); break; } Index: ossp-pkg/str/str_format.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_format.c,v rcsdiff -q -kk '-r1.27' '-r1.28' -u '/v/ossp/cvs/ossp-pkg/str/str_format.c,v' 2>/dev/null --- str_format.c 2002/04/01 08:32:54 1.27 +++ str_format.c 2003/01/06 19:13:47 1.28 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -35,7 +35,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -108,7 +108,7 @@ #define FLOAT_DIGITS 6 #define EXPONENT_LENGTH 10 -/* NUM_BUF_SIZE is the size of the buffer used for arithmetic +/* NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions. This is a magic number; do NOT decrease it! */ #define NUM_BUF_SIZE 512 #define NDIG 80 @@ -121,7 +121,7 @@ #define isinf(d) (0) #endif -/* +/* * Convert decimal number to its string representation. The number of * digits is specified by ndigit decpt is set to the position of the * decimal point sign is set to 0 for positive, 1 for negative. buf must @@ -136,10 +136,10 @@ static char * str_cvt( - double arg, - int ndigits, - int *decpt, - BOOL *sign, + double arg, + int ndigits, + int *decpt, + BOOL *sign, int eflag, char *buf) { @@ -215,9 +215,9 @@ static char * str_gcvt( - double number, - int ndigit, - char *buf, + double number, + int ndigit, + char *buf, BOOL altform) { BOOL sign; @@ -299,7 +299,7 @@ } /* - * Convert a string to decimal value + * Convert a string to decimal value */ #define NUM(c) ((c) - '0') #define STR_TO_DEC(str, num) { \ @@ -309,7 +309,7 @@ num += NUM(*str++) ; \ } \ } - + /* * This macro does zero padding so that the precision requirement is * satisfied. The padding is done by adding '0's to the left of the @@ -324,7 +324,7 @@ } /* - * This macro does padding. + * This macro does padding. * The padding is done by printing the character ch. */ #define PAD(width, len, ch) \ @@ -358,9 +358,9 @@ */ static char * conv_10( - register long_int num, + register long_int num, register BOOL is_unsigned, - register BOOL *is_negative, + register BOOL *is_negative, char *buf_end, register int *len) { @@ -373,7 +373,7 @@ } else { *is_negative = (num < 0); - /* On a 2's complement machine, negating the most negative integer + /* On a 2's complement machine, negating the most negative integer results in a number that cannot be represented as a signed integer. Here is what we do to obtain the number's magnitude: a. add 1 to the number @@ -400,9 +400,9 @@ static char * conv_10_quad( - quad_int num, + quad_int num, register BOOL is_unsigned, - register BOOL *is_negative, + register BOOL *is_negative, char *buf_end, register int *len) { @@ -415,7 +415,7 @@ } else { *is_negative = (num < 0); - /* On a 2's complement machine, negating the most negative integer + /* On a 2's complement machine, negating the most negative integer result in a number that cannot be represented as a signed integer. Here is what we do to obtain the number's magnitude: a. add 1 to the number @@ -447,12 +447,12 @@ */ static char * conv_fp( - register char format, + register char format, register double num, - BOOL add_dp, - int precision, + BOOL add_dp, + int precision, BOOL *is_negative, - char *buf, + char *buf, int *len) { register char *s = buf; @@ -508,7 +508,7 @@ *s++ = format; /* either e or E */ decimal_point--; if (decimal_point != 0) { - p = conv_10((long_int) decimal_point, FALSE, &exponent_is_negative, + p = conv_10((long_int) decimal_point, FALSE, &exponent_is_negative, &temp[EXPONENT_LENGTH], &t_len); *s++ = exponent_is_negative ? '-' : '+'; /* Make sure the exponent has at least 2 digits */ @@ -545,10 +545,10 @@ static char * conv_p2( - register u_long_int num, + register u_long_int num, register int nbits, - char format, - char *buf_end, + char format, + char *buf_end, register int *len) { register int mask = (1 << nbits) - 1; @@ -565,10 +565,10 @@ static char * conv_p2_quad( - u_quad_int num, + u_quad_int num, register int nbits, - char format, - char *buf_end, + char format, + char *buf_end, register int *len) { register int mask = (1 << nbits) - 1; @@ -583,14 +583,14 @@ return p; } -/* +/* * str_vformat(), the generic printf-style formatting routine * and heart of this piece of source. */ -int +int str_vformat( - str_vformat_t *vbuff, - const char *fmt, + str_vformat_t *vbuff, + const char *fmt, va_list ap) { register char *sp; @@ -884,7 +884,7 @@ else { /* use &num_buf[1], so that we have room for the sign */ s = conv_fp(*fmt, fp_num, alternate_form, - (adjust_precision == FALSE) ? FLOAT_DIGITS : precision, + (adjust_precision == FALSE) ? FLOAT_DIGITS : precision, &is_negative, &num_buf[1], &s_len); if (is_negative) prefix_char = '-'; @@ -959,7 +959,7 @@ break; /* - * Pointer argument type. + * Pointer argument type. */ case 'p': #if defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == SIZEOF_VOID_P) @@ -992,8 +992,8 @@ default: s = NULL; if (vbuff->format != NULL) { - s = vbuff->format(vbuff, - &prefix_char, &pad_char, &s_len, + s = vbuff->format(vbuff, + &prefix_char, &pad_char, &s_len, num_buf, NUM_BUF_SIZE, extinfo, *fmt, ap); } if (s == NULL) { @@ -1022,7 +1022,7 @@ } /* - * Print the string s. + * Print the string s. */ for (i = s_len; i != 0; i--) { INS_CHAR(*s, sp, bep, cc); @@ -1128,5 +1128,5 @@ return NULL; return s; } -#endif +#endif Index: ossp-pkg/str/str_hash.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_hash.c,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/str/str_hash.c,v' 2>/dev/null --- str_hash.c 2002/04/01 08:32:54 1.6 +++ str_hash.c 2003/01/06 19:13:47 1.7 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -24,7 +24,7 @@ ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ** SUCH DAMAGE. ** -** str_hash.c: hashing functions +** str_hash.c: hashing functions */ #include "str_p.h" @@ -45,7 +45,7 @@ * even numbers are not useable at all. The remaining 128 odd numbers * (except for the number 1) work more or less all equally well. They * all distribute in an acceptable way and this way fill a hash table - * with an average percent of approx. 86%. + * with an average percent of approx. 86%. * * If one compares the Chi/2 values resulting of the various * multipliers, the 33 not even has the best value. But the 33 and a @@ -58,9 +58,9 @@ * few values should be preferred and seems to be also the reason why * Daniel J. Bernstein also preferred it. */ -static unsigned long +static unsigned long hash_djbx33( - register unsigned char *key, + register unsigned char *key, register str_size_t len) { register unsigned long hash = 5381; @@ -103,7 +103,7 @@ * hash functions (i.e. same function signature). It can be definitely * recommended as a very good general purpose hashing function. */ -static unsigned long +static unsigned long hash_bjddj( register unsigned char *k, register str_size_t length) @@ -140,7 +140,7 @@ /* handle the last 11 bytes */ c += length; - switch(len) { + switch(len) { /* all the case statements fall through */ case 11: c += ((ub4)k[10]<<24); case 10: c += ((ub4)k[ 9]<<16); @@ -176,7 +176,7 @@ * hash function. It should be used if good distribution is more * important than high performance. */ -static unsigned long +static unsigned long hash_macrc32( register unsigned char *key, register str_size_t len) @@ -237,7 +237,7 @@ 0x2d02ef8dL }; register unsigned long hash; - + /* compute hash with the help of the table */ hash = 0xffffffff; while (len-- > 0) @@ -251,10 +251,10 @@ /* * The API function. */ -unsigned long +unsigned long str_hash( - const char *s, - str_size_t n, + const char *s, + str_size_t n, int mode) { unsigned long hash; Index: ossp-pkg/str/str_memory.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_memory.c,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/str/str_memory.c,v' 2>/dev/null --- str_memory.c 2002/04/01 08:32:54 1.7 +++ str_memory.c 2003/01/06 19:13:47 1.8 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -35,7 +35,7 @@ static void * _str_mem_dup( - void *mem, + void *mem, size_t bytes) { void *dmem; @@ -53,8 +53,8 @@ #else static void * _str_mem_set( - void *dst0, - int c0, + void *dst0, + int c0, size_t bytes) { register size_t t; @@ -75,7 +75,7 @@ } /* fill the whole stamping word */ - if ((c = (unsigned char)c0) != 0) { + if ((c = (unsigned char)c0) != 0) { c = c | (c << 8); #if (SIZEOF_INT > 2) c = c | (c << 16); @@ -118,8 +118,8 @@ #else static void * _str_mem_move( - void *dst, - const void *src, + void *dst, + const void *src, size_t bytes) { register unsigned char *dst_p; @@ -129,7 +129,7 @@ return NULL; src_p = src; dst_p = dst; - if (dst > src) { + if (dst > src) { /* must go high to low */ src_p += bytes; dst_p += bytes; @@ -147,7 +147,7 @@ static void * _str_mem_rev( - void *src, + void *src, size_t bytes) { register unsigned char *p1; @@ -166,8 +166,8 @@ #else static void * _str_mem_char( - const void *src, - int c, + const void *src, + int c, size_t bytes) { register const unsigned char *cp; @@ -185,13 +185,13 @@ static void * _str_mem_mem( - const void *haystack, size_t haystack_len, + const void *haystack, size_t haystack_len, const void *needle, size_t needle_len) { register const char *begin; register const char *last_possible; - - if (needle_len == 0) + + if (needle_len == 0) /* The first occurrence of the empty string is deemed to occur at the end of the string. */ return (void *)&((const char *)haystack)[haystack_len - 1]; @@ -209,13 +209,13 @@ #else static int _str_mem_cmp( - const void *src1, - const void *src2, + const void *src1, + const void *src2, size_t bytes) { register const unsigned char *cp1; register const unsigned char *cp2; - + if (bytes != 0) { cp1 = src1; cp2 = src2; Index: ossp-pkg/str/str_p.h RCS File: /v/ossp/cvs/ossp-pkg/str/str_p.h,v rcsdiff -q -kk '-r1.20' '-r1.21' -u '/v/ossp/cvs/ossp-pkg/str/str_p.h,v' 2>/dev/null --- str_p.h 2002/04/01 09:03:49 1.20 +++ str_p.h 2003/01/06 19:13:47 1.21 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -67,9 +67,9 @@ struct str_vformat_st { char *curpos; char *endpos; - union { - int i; long l; - double d; void *p; + union { + int i; long l; + double d; void *p; } data[6]; int (*flush)(struct str_vformat_st *); char *(*format)( Index: ossp-pkg/str/str_parse.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_parse.c,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/str/str_parse.c,v' 2>/dev/null --- str_parse.c 2002/04/01 08:32:54 1.19 +++ str_parse.c 2003/01/06 19:13:47 1.20 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -24,18 +24,18 @@ ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ** SUCH DAMAGE. ** -** str_parse.c: parsing functions +** str_parse.c: parsing functions */ #include "str_p.h" /* compile a regular expression pattern from string into internal format */ -static int +static int pattern_compile( - const char *ptr, - int len, - int opt, - pcre **p_pcre, + const char *ptr, + int len, + int opt, + pcre **p_pcre, pcre_extra **p_pcre_extra) { const char *err_str; @@ -99,7 +99,7 @@ static int hash_initialized = FALSE; /* initialize cache hash table */ -static void +static void hash_init(void) { int i; @@ -109,7 +109,7 @@ } /* destroy cache hash table */ -static void +static void hash_destroy(void) { int i; @@ -130,9 +130,9 @@ } /* the hashing function: a popular `times 33' hash */ -static unsigned int +static unsigned int hash_func( - const char *key, + const char *key, int keylen) { unsigned int h; @@ -145,11 +145,11 @@ } /* cache a pattern */ -static void +static void pattern_cache( - const char *key, - int keylen, - pcre *p_pcre, + const char *key, + int keylen, + pcre *p_pcre, pcre_extra *p_pcre_extra) { int h; @@ -179,11 +179,11 @@ } /* lookup a pattern */ -static void +static void pattern_lookup( - const char *key, - int keylen, - pcre **p_pcre, + const char *key, + int keylen, + pcre **p_pcre, pcre_extra **p_pcre_extra) { int h; @@ -206,32 +206,32 @@ return; } -static int +static int str_parse_flush_nop( str_vformat_t *sf) -{ +{ sf->data[2].i = sf->data[2].i + sf->data[1].i; sf->curpos = (char *)sf->data[0].p; return 0; -} +} -static int +static int str_parse_flush_str( str_vformat_t *sf) -{ +{ return -1; -} +} static char * str_parse_format( str_vformat_t *sf, char *cpPrefix, - char *cpPad, + char *cpPad, int *ipStrLen, - char *cpBuf, - int nBufLen, - char *cpExtinfo, - int cFmt, + char *cpBuf, + int nBufLen, + char *cpExtinfo, + int cFmt, va_list ap) { char *pStr; @@ -239,7 +239,7 @@ int *cap_vec; int cap_num; char *string; - + pStr = NULL; if (cFmt == 'R') { if (cpExtinfo != NULL && str_isdigit(cpExtinfo[0]) && cpExtinfo[1] == NUL) { @@ -273,7 +273,7 @@ { pcre *p_pcre = NULL; pcre_extra *p_pcre_extra = NULL; - const char *match_ptr; + const char *match_ptr; int match_len; int match_opt; int match_once; @@ -313,13 +313,13 @@ return 0; } - /* - * Check input parameters + /* + * Check input parameters */ if (string == NULL || pattern == NULL) return -1; - /* + /* * Parse pattern */ match_ptr = NULL; @@ -341,7 +341,7 @@ if (!ismop) if (*pattern == 's' && str_len(pattern) >= 4) if ((cp = str_span(pattern, 0, "imsxo", STR_RIGHT)) > pattern+1) - if ((cb[0] = *cp, cb[1] = NUL, + if ((cb[0] = *cp, cb[1] = NUL, cp2 = str_span(pattern, cp-pattern, cb, STR_RIGHT|STR_COMPLEMENT)) > pattern+1) if (*(pattern+1) == *cp && *(pattern+1) == *cp2) issop = TRUE; @@ -390,7 +390,7 @@ ismop = TRUE; } - /* + /* * Compile pattern into internal PCRE structure */ if (match_once) { @@ -409,8 +409,8 @@ return -1; } - /* - * Allocate storage for offset table of captured substrings + /* + * Allocate storage for offset table of captured substrings */ cap_vec = NULL; cap_len = 0; @@ -426,7 +426,7 @@ } } - /* + /* * Perform the matching operation */ n = pcre_exec(p_pcre, p_pcre_extra, string, str_len(string), 0, 0, cap_vec, cap_len); @@ -446,8 +446,8 @@ * Create either matching or substitution result */ if (ismop && cap_num > 0) { - /* - * extract captured substrings into caller provided pointer variables + /* + * extract captured substrings into caller provided pointer variables */ if (match_1resbuf) { /* use a single result buffer */ @@ -507,7 +507,7 @@ } } else if (issop) { - /* + /* * create a substitutional string with optional expansions */ @@ -553,7 +553,7 @@ /* remove output argument from varargs */ cpp = va_arg(ap, char **); - /* calculate output buffer requirement */ + /* calculate output buffer requirement */ sf.curpos = buf2; sf.endpos = buf2 + sizeof(buf2) - 1; sf.flush = str_parse_flush_nop; Index: ossp-pkg/str/str_pcre.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_pcre.c,v rcsdiff -q -kk '-r1.7' '-r1.8' -u '/v/ossp/cvs/ossp-pkg/str/str_pcre.c,v' 2>/dev/null --- str_pcre.c 2002/01/11 10:27:09 1.7 +++ str_pcre.c 2003/01/06 19:13:47 1.8 @@ -1,4 +1,4 @@ -/* +/* * Perl Compatible Regular Expression (PCRE) Library * Copyright (c) 1997-2001 Philip Hazel * Copyright (c) 1997-2001 University of Cambridge @@ -12,7 +12,7 @@ * for this version. */ -/* +/* This is a library of functions to support regular expressions whose syntax and semantics are as close as possible to those of the Perl 5 language. See the file Tech.Notes for some information on the internals. Index: ossp-pkg/str/str_search.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_search.c,v rcsdiff -q -kk '-r1.18' '-r1.19' -u '/v/ossp/cvs/ossp-pkg/str/str_search.c,v' 2>/dev/null --- str_search.c 2002/04/01 08:32:54 1.18 +++ str_search.c 2003/01/06 19:13:48 1.19 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -28,7 +28,7 @@ */ #include "str_p.h" - + /* * str_span -- span over a set of character in a string. * This is a spanning function inspired by POSIX strchr(3) and @@ -53,7 +53,7 @@ rv = NULL; if (!(mode & STR_RIGHT) && !(mode & STR_COMPLEMENT)) { /* span from left to right while chars are in charset */ - sp = s; + sp = s; l1: sc = *sp++; n--; if (sc != NUL && n >= 0) { @@ -81,7 +81,7 @@ } else if (!(mode & STR_RIGHT) && (mode & STR_COMPLEMENT)) { /* span from left to right while chars are NOT in charset */ - sp = s; + sp = s; l3a: sc = *sp++; n--; if (sc != NUL && n >= 0) { @@ -147,24 +147,24 @@ if (*x == NUL) return (char *)y; - /* + /* * Preprocessing */ /* determine length of strings */ str_ilen(m, x); - if (n == 0) + if (n == 0) str_ilen(n, y); /* fill whole bad char skip array */ - for (i = 0; i < (sizeof(qs_bc)/sizeof(int)); i++) + for (i = 0; i < (sizeof(qs_bc)/sizeof(int)); i++) qs_bc[(int)i] = m+1; /* override positions related to pattern */ - for (i = 0; i < m; i++) + for (i = 0; i < m; i++) qs_bc[(int)*(x+i)] = m-i; - - /* + + /* * Searching */ Index: ossp-pkg/str/str_test.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_test.c,v rcsdiff -q -kk '-r1.25' '-r1.26' -u '/v/ossp/cvs/ossp-pkg/str/str_test.c,v' 2>/dev/null --- str_test.c 2002/04/01 09:03:49 1.25 +++ str_test.c 2003/01/06 19:13:48 1.26 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -191,7 +191,7 @@ } TS_TEST(test_tokenize) -{ +{ char *cp; char *cp2; char *cp3; @@ -266,20 +266,20 @@ rv = str_parse(test2_tab[i].s, test2_tab[i].p, &r1, &r2, &r3, &r4); } if (rv != test2_tab[i].rv || - ((r1 == NULL && test2_tab[i].r1 != NULL) || - (r1 != NULL && test2_tab[i].r1 == NULL) || + ((r1 == NULL && test2_tab[i].r1 != NULL) || + (r1 != NULL && test2_tab[i].r1 == NULL) || (r1 != NULL && test2_tab[i].r1 != NULL && strcmp(r1, test2_tab[i].r1) != 0)) || - ((r2 == NULL && test2_tab[i].r2 != NULL) || - (r2 != NULL && test2_tab[i].r2 == NULL) || + ((r2 == NULL && test2_tab[i].r2 != NULL) || + (r2 != NULL && test2_tab[i].r2 == NULL) || (r2 != NULL && test2_tab[i].r2 != NULL && strcmp(r2, test2_tab[i].r2) != 0)) || - ((r3 == NULL && test2_tab[i].r3 != NULL) || - (r3 != NULL && test2_tab[i].r3 == NULL) || + ((r3 == NULL && test2_tab[i].r3 != NULL) || + (r3 != NULL && test2_tab[i].r3 == NULL) || (r3 != NULL && test2_tab[i].r3 != NULL && strcmp(r3, test2_tab[i].r3) != 0)) || - ((r4 == NULL && test2_tab[i].r4 != NULL) || - (r4 != NULL && test2_tab[i].r4 == NULL) || + ((r4 == NULL && test2_tab[i].r4 != NULL) || + (r4 != NULL && test2_tab[i].r4 == NULL) || (r4 != NULL && test2_tab[i].r4 != NULL && strcmp(r4, test2_tab[i].r4) != 0))) { ts_test_fail(TS_CTX, "expected result: %d + <%s><%s><%s><%s>", - test2_tab[i].rv, + test2_tab[i].rv, test2_tab[i].r1 == NULL ? "NULL" : test2_tab[i].r1, test2_tab[i].r2 == NULL ? "NULL" : test2_tab[i].r2, test2_tab[i].r3 == NULL ? "NULL" : test2_tab[i].r3, @@ -391,7 +391,7 @@ { unsigned char ucp[256]; int i; - + ts_test_check(TS_CTX, "encode/decode of 0 bytes"); for (i = 0; i < 256; i++) ucp[i] = 0x55; Index: ossp-pkg/str/str_token.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_token.c,v rcsdiff -q -kk '-r1.8' '-r1.9' -u '/v/ossp/cvs/ossp-pkg/str/str_token.c,v' 2>/dev/null --- str_token.c 2002/04/01 08:32:55 1.8 +++ str_token.c 2003/01/06 19:13:48 1.9 @@ -1,9 +1,9 @@ /* ** OSSP str - String Handling -** Copyright (c) 1999-2002 Ralf S. Engelschall -** Copyright (c) 1999-2002 The OSSP Project +** Copyright (c) 1999-2003 Ralf S. Engelschall +** Copyright (c) 1999-2003 The OSSP Project ** -** This file is part of OSSP str, a string handling and manipulation +** 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 @@ -24,7 +24,7 @@ ** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ** SUCH DAMAGE. ** -** str_token.c: tokenizing functions +** str_token.c: tokenizing functions */ #include "str_p.h" @@ -44,11 +44,11 @@ */ /* - * isoneof -- check whether c is one of the chars in c + * isoneof -- check whether c is one of the chars in c */ -static int +static int isoneof( - register char c, + register char c, register const char *s) { for (; *s != NUL; s++) @@ -58,7 +58,7 @@ } /* - * nextchar -- get next character from a string + * nextchar -- get next character from a string */ static char * nextchar( @@ -177,15 +177,15 @@ cs_comment = ""; /* skip leading delimiters */ - p = *s; + p = *s; while (*p != NUL && isoneof(*p, cs_delim)) p++; /* end of string, so stop parsing */ - if (*p == NUL) + if (*p == NUL) return NULL; - /* + /* * start of comment reached, so stop parsing but update the parsing * cursor just in case the user wants to recover the comment */ @@ -195,7 +195,7 @@ return NULL; } - /* + /* * Set `cpToken' to point to returned string. * Then use p and q to walk through the string: * - p will follow the input characters; @@ -210,7 +210,7 @@ cLeftQuote = NUL; if ((mode & STR_BACKSLASHESC) || (mode & STR_TRIGRAPHS)) { - /* + /* * parse while recognizing backslash escapes */ while (bInToken && (p = nextchar(p, &c, bWithTrigraphs, &bBackslashed)) != NULL) { @@ -220,7 +220,7 @@ } else if (!bInQuote && *cs_delim != NUL && isoneof(c, cs_delim)) { /* reached end of token */ - *q = NUL; + *q = NUL; bInToken = FALSE; } else if (!bInQuote && *cs_comment != NUL && isoneof(c, cs_comment)) { @@ -231,7 +231,7 @@ } else if (!bInQuote && *cs_quote != NUL && isoneof(c, cs_quote)) { /* beginning a quoted segment */ - bInQuote = TRUE; + bInQuote = TRUE; cLeftQuote = c; if (!(mode & STR_STRIPQUOTES)) *q++ = c; @@ -249,7 +249,7 @@ } } else { - /* + /* * parse while ignoring backslash escapes */ while (bInToken && *p != NUL) { @@ -274,7 +274,7 @@ } else if (bInQuote && cLeftQuote == *p) { /* ending a quoted segment */ - bInQuote = FALSE; + bInQuote = FALSE; p++; if (!(mode & STR_STRIPQUOTES)) *q++ = cLeftQuote; @@ -288,9 +288,9 @@ /* terminate token and update parsing cursor */ *q = NUL; - *s = p; + *s = p; - /* skip trailing delimiters + /* skip trailing delimiters (if requested only, else we do it on next round) */ if ((mode & STR_SKIPDELIMS) && *s != NULL) { while (*(*s) != NUL && isoneof(*(*s), cs_delim)) Index: ossp-pkg/str/str_version.c RCS File: /v/ossp/cvs/ossp-pkg/str/str_version.c,v rcsdiff -q -kk '-r1.14' '-r1.15' -u '/v/ossp/cvs/ossp-pkg/str/str_version.c,v' 2>/dev/null --- str_version.c 2002/04/01 08:32:55 1.14 +++ str_version.c 2003/01/06 19:13:48 1.15 @@ -8,7 +8,7 @@ #ifndef _STR_VERSION_C_ #define _STR_VERSION_C_ -#define STR_VERSION 0x009207 +#define STR_VERSION 0x009208 typedef struct { const int v_hex; @@ -32,13 +32,13 @@ #undef _STR_VERSION_C_AS_HEADER_ str_version_t str_version = { - 0x009207, - "0.9.7", - "0.9.7 (01-Apr-2002)", - "This is OSSP str, Version 0.9.7 (01-Apr-2002)", - "OSSP str 0.9.7 (01-Apr-2002)", - "OSSP str/0.9.7", - "@(#)OSSP str 0.9.7 (01-Apr-2002)", + 0x009208, + "0.9.8", + "0.9.8 (06-Jan-2003)", + "This is OSSP str, Version 0.9.8 (06-Jan-2003)", + "OSSP str 0.9.8 (06-Jan-2003)", + "OSSP str/0.9.8", + "@(#)OSSP str 0.9.8 (06-Jan-2003)", "$Id$" };