summaryrefslogtreecommitdiff
path: root/db/clib
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-12-15 21:42:09 +0000
committerjbj <devnull@localhost>2003-12-15 21:42:09 +0000
commit8960e3895f7af91126465368dff8fbb36ab4e853 (patch)
tree3c515e39dde0e88edeb806ea87d08524ba25c761 /db/clib
parent752cac72e220dcad4e6fce39508e714e59e3e0a1 (diff)
downloadlibrpm-tizen-8960e3895f7af91126465368dff8fbb36ab4e853.tar.gz
librpm-tizen-8960e3895f7af91126465368dff8fbb36ab4e853.tar.bz2
librpm-tizen-8960e3895f7af91126465368dff8fbb36ab4e853.zip
- upgrade to db-4.2.52.
CVS patchset: 6972 CVS date: 2003/12/15 21:42:09
Diffstat (limited to 'db/clib')
-rw-r--r--db/clib/getcwd.c20
-rw-r--r--db/clib/getopt.c19
-rw-r--r--db/clib/memcmp.c4
-rw-r--r--db/clib/memmove.c4
-rw-r--r--db/clib/raise.c8
-rw-r--r--db/clib/snprintf.c39
-rw-r--r--db/clib/strcasecmp.c34
-rw-r--r--db/clib/strdup.c2
-rw-r--r--db/clib/strerror.c4
-rw-r--r--db/clib/vsnprintf.c6
10 files changed, 101 insertions, 39 deletions
diff --git a/db/clib/getcwd.c b/db/clib/getcwd.c
index 630facb4f..10485f176 100644
--- a/db/clib/getcwd.c
+++ b/db/clib/getcwd.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 1997, 1998, 1999, 2000
+ * Copyright (c) 1996-2003
* Sleepycat Software. All rights reserved.
*/
/*
@@ -36,7 +36,7 @@
#include "db_config.h"
#ifndef lint
-static const char revid[] = "$Id: getcwd.c,v 11.7 2000/11/30 00:58:30 ubell Exp $";
+static const char revid[] = "$Id: getcwd.c,v 11.14 2003/01/08 04:06:37 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -120,7 +120,7 @@ getcwd(pt, size)
ept = pt + size;
} else {
if ((ret =
- __os_malloc(NULL, ptsize = 1024 - 4, NULL, &pt)) != 0) {
+ __os_malloc(NULL, ptsize = 1024 - 4, &pt)) != 0) {
__os_set_errno(ret);
return (NULL);
}
@@ -134,7 +134,7 @@ getcwd(pt, size)
* Should always be enough (it's 340 levels). If it's not, allocate
* as necessary. Special case the first stat, it's ".", not "..".
*/
- if ((ret = __os_malloc(NULL, upsize = 1024 - 4, NULL, &up)) != 0)
+ if ((ret = __os_malloc(NULL, upsize = 1024 - 4, &up)) != 0)
goto err;
eup = up + 1024;
bup = up;
@@ -167,7 +167,7 @@ getcwd(pt, size)
* been that way and stuff would probably break.
*/
bcopy(bpt, pt, ept - bpt);
- __os_free(up, upsize);
+ __os_free(NULL, up);
return (pt);
}
@@ -177,7 +177,7 @@ getcwd(pt, size)
* possible component name, plus a trailing NULL.
*/
if (bup + 3 + MAXNAMLEN + 1 >= eup) {
- if (__os_realloc(NULL, upsize *= 2, NULL, &up) != 0)
+ if (__os_realloc(NULL, upsize *= 2, &up) != 0)
goto err;
bup = up;
eup = up + upsize;
@@ -238,7 +238,7 @@ getcwd(pt, size)
}
off = bpt - pt;
len = ept - bpt;
- if (__os_realloc(NULL, ptsize *= 2, NULL, &pt) != 0)
+ if (__os_realloc(NULL, ptsize *= 2, &pt) != 0)
goto err;
bpt = pt + off;
ept = pt + ptsize;
@@ -261,12 +261,12 @@ notfound:
* didn't find the current directory in its parent directory, set
* errno to ENOENT.
*/
- if (__os_get_errno() == 0)
+ if (__os_get_errno_ret_zero() == 0)
__os_set_errno(save_errno == 0 ? ENOENT : save_errno);
/* FALLTHROUGH */
err:
if (ptsize)
- __os_free(pt, ptsize);
- __os_free(up, upsize);
+ __os_free(NULL, pt);
+ __os_free(NULL, up);
return (NULL);
}
diff --git a/db/clib/getopt.c b/db/clib/getopt.c
index 667fca1d7..56f43afb3 100644
--- a/db/clib/getopt.c
+++ b/db/clib/getopt.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 1997, 1998, 1999, 2000
+ * Copyright (c) 1996-2003
* Sleepycat Software. All rights reserved.
*/
/*
@@ -36,7 +36,7 @@
#include "db_config.h"
#ifndef lint
-static const char revid[] = "$Id: getopt.c,v 11.4 2000/02/14 02:59:40 bostic Exp $";
+static const char revid[] = "$Id: getopt.c,v 11.8 2003/01/08 04:06:38 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -47,6 +47,8 @@ static const char revid[] = "$Id: getopt.c,v 11.4 2000/02/14 02:59:40 bostic Exp
#include "db_int.h"
+int __db_getopt_reset; /* global reset for VxWorks. */
+
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt, /* character checked for validity */
@@ -78,6 +80,19 @@ getopt(nargc, nargv, ostr)
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
+ /*
+ * VxWorks needs to be able to repeatedly call getopt from multiple
+ * programs within its global name space.
+ */
+ if (__db_getopt_reset) {
+ __db_getopt_reset = 0;
+
+ opterr = optind = 1;
+ optopt = optreset = 0;
+ optarg = NULL;
+ progname = NULL;
+ place = EMSG;
+ }
if (!progname) {
if ((progname = __db_rpath(*nargv)) == NULL)
progname = *nargv;
diff --git a/db/clib/memcmp.c b/db/clib/memcmp.c
index 2aedc3fa6..4143a5482 100644
--- a/db/clib/memcmp.c
+++ b/db/clib/memcmp.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 1997, 1998, 1999, 2000
+ * Copyright (c) 1996-2003
* Sleepycat Software. All rights reserved.
*/
/*
@@ -36,7 +36,7 @@
#include "db_config.h"
#ifndef lint
-static const char revid[] = "$Id: memcmp.c,v 11.5 2000/02/24 21:58:12 bostic Exp $";
+static const char revid[] = "$Id: memcmp.c,v 11.8 2003/01/08 04:06:38 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
diff --git a/db/clib/memmove.c b/db/clib/memmove.c
index da6bcfe8b..e92cbf494 100644
--- a/db/clib/memmove.c
+++ b/db/clib/memmove.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 1997, 1998, 1999, 2000
+ * Copyright (c) 1996-2003
* Sleepycat Software. All rights reserved.
*/
/*
@@ -36,7 +36,7 @@
#include "db_config.h"
#ifndef lint
-static const char revid[] = "$Id: memmove.c,v 11.4 2000/02/14 02:59:40 bostic Exp $";
+static const char revid[] = "$Id: memmove.c,v 11.7 2003/01/08 04:06:38 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
diff --git a/db/clib/raise.c b/db/clib/raise.c
index acec86cd6..27305549f 100644
--- a/db/clib/raise.c
+++ b/db/clib/raise.c
@@ -1,14 +1,14 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 1998, 1999, 2000
+ * Copyright (c) 1997-2003
* Sleepycat Software. All rights reserved.
*/
#include "db_config.h"
#ifndef lint
-static const char revid[] = "$Id: raise.c,v 11.3 2000/02/14 02:59:41 bostic Exp $";
+static const char revid[] = "$Id: raise.c,v 11.7 2003/01/08 04:06:41 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -28,5 +28,9 @@ int
raise(s)
int s;
{
+ /*
+ * Do not use __os_id(), as it may not return the process ID -- any
+ * system with kill(3) probably has getpid(3).
+ */
return (kill(getpid(), s));
}
diff --git a/db/clib/snprintf.c b/db/clib/snprintf.c
index 6aa9e3ae6..e41272dde 100644
--- a/db/clib/snprintf.c
+++ b/db/clib/snprintf.c
@@ -1,14 +1,14 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 1997, 1998, 1999, 2000
+ * Copyright (c) 1996-2003
* Sleepycat Software. All rights reserved.
*/
#include "db_config.h"
#ifndef lint
-static const char revid[] = "$Id: snprintf.c,v 11.5 2000/12/22 19:38:37 bostic Exp $";
+static const char revid[] = "$Id: snprintf.c,v 11.12 2003/05/02 16:10:41 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -29,7 +29,7 @@ static const char revid[] = "$Id: snprintf.c,v 11.5 2000/12/22 19:38:37 bostic E
*/
#ifndef HAVE_SNPRINTF
int
-#ifdef __STDC__
+#ifdef STDC_HEADERS
snprintf(char *str, size_t n, const char *fmt, ...)
#else
snprintf(str, n, fmt, va_alist)
@@ -39,23 +39,36 @@ snprintf(str, n, fmt, va_alist)
va_dcl
#endif
{
+ static int ret_charpnt = -1;
va_list ap;
- int rval;
+ int len;
COMPQUIET(n, 0);
-#ifdef __STDC__
+
+ /*
+ * Some old versions of sprintf return a pointer to the first argument
+ * instead of a character count. Assume the return value of snprintf,
+ * vsprintf, etc. will be the same as sprintf, and check the easy one.
+ *
+ * We do this test at run-time because it's not a test we can do in a
+ * cross-compilation environment.
+ */
+ if (ret_charpnt == -1) {
+ char buf[10];
+
+ ret_charpnt =
+ sprintf(buf, "123") != 3 ||
+ sprintf(buf, "123456789") != 9 ||
+ sprintf(buf, "1234") != 4;
+ }
+
+#ifdef STDC_HEADERS
va_start(ap, fmt);
#else
va_start(ap);
#endif
-#ifdef SPRINTF_RET_CHARPNT
- (void)vsprintf(str, fmt, ap);
+ len = vsprintf(str, fmt, ap);
va_end(ap);
- return (strlen(str));
-#else
- rval = vsprintf(str, fmt, ap);
- va_end(ap);
- return (rval);
-#endif
+ return (ret_charpnt ? (int)strlen(str) : len);
}
#endif
diff --git a/db/clib/strcasecmp.c b/db/clib/strcasecmp.c
index 6633197bc..d5ce6d76d 100644
--- a/db/clib/strcasecmp.c
+++ b/db/clib/strcasecmp.c
@@ -34,7 +34,7 @@
#include "db_config.h"
#ifndef lint
-static const char revid[] = "$Id: strcasecmp.c,v 1.4 2000/03/24 22:31:31 bostic Exp $";
+static const char revid[] = "$Id: strcasecmp.c,v 1.7 2001/11/15 17:51:38 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -78,14 +78,16 @@ static const unsigned char charmap[] = {
'\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
'\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
'\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
+ '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
};
/*
* strcasecmp --
* Do strcmp(3) in a case-insensitive manner.
*
+ * PUBLIC: #ifndef HAVE_STRCASECMP
* PUBLIC: int strcasecmp __P((const char *, const char *));
+ * PUBLIC: #endif
*/
int
strcasecmp(s1, s2)
@@ -100,3 +102,31 @@ strcasecmp(s1, s2)
return (0);
return (cm[*us1] - cm[*--us2]);
}
+
+/*
+ * strncasecmp --
+ * Do strncmp(3) in a case-insensitive manner.
+ *
+ * PUBLIC: #ifndef HAVE_STRCASECMP
+ * PUBLIC: int strncasecmp __P((const char *, const char *, size_t));
+ * PUBLIC: #endif
+ */
+int
+strncasecmp(s1, s2, n)
+ const char *s1, *s2;
+ register size_t n;
+{
+ if (n != 0) {
+ register const unsigned char *cm = charmap,
+ *us1 = (const unsigned char *)s1,
+ *us2 = (const unsigned char *)s2;
+
+ do {
+ if (cm[*us1] != cm[*us2++])
+ return (cm[*us1] - cm[*--us2]);
+ if (*us1++ == '\0')
+ break;
+ } while (--n != 0);
+ }
+ return (0);
+}
diff --git a/db/clib/strdup.c b/db/clib/strdup.c
index e82d2afcb..e68623f14 100644
--- a/db/clib/strdup.c
+++ b/db/clib/strdup.c
@@ -34,7 +34,7 @@
#include "db_config.h"
#ifndef lint
-static const char revid[] = "Id: strdup.c,v 1.5 2002/05/01 18:40:05 bostic Exp ";
+static const char revid[] = "$Id: strdup.c,v 1.5 2002/05/01 18:40:05 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
diff --git a/db/clib/strerror.c b/db/clib/strerror.c
index 0f7447b04..a98cab450 100644
--- a/db/clib/strerror.c
+++ b/db/clib/strerror.c
@@ -1,7 +1,7 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1997, 1998, 1999, 2000
+ * Copyright (c) 1997-2003
* Sleepycat Software. All rights reserved.
*/
/*
@@ -36,7 +36,7 @@
#include "db_config.h"
#ifndef lint
-static const char revid[] = "$Id: strerror.c,v 11.4 2000/02/14 02:59:41 bostic Exp $";
+static const char revid[] = "$Id: strerror.c,v 11.7 2003/01/08 04:06:43 bostic Exp $";
#endif /* not lint */
/*
diff --git a/db/clib/vsnprintf.c b/db/clib/vsnprintf.c
index 3d27bc0d2..2bce3b762 100644
--- a/db/clib/vsnprintf.c
+++ b/db/clib/vsnprintf.c
@@ -1,14 +1,14 @@
/*-
* See the file LICENSE for redistribution information.
*
- * Copyright (c) 1996, 1997, 1998, 1999, 2000
+ * Copyright (c) 1996-2003
* Sleepycat Software. All rights reserved.
*/
#include "db_config.h"
#ifndef lint
-static const char revid[] = "$Id: vsnprintf.c,v 11.4 2000/05/18 19:24:59 bostic Exp $";
+static const char revid[] = "$Id: vsnprintf.c,v 11.8 2003/01/08 04:06:46 bostic Exp $";
#endif /* not lint */
#ifndef NO_SYSTEM_INCLUDES
@@ -24,7 +24,7 @@ static const char revid[] = "$Id: vsnprintf.c,v 11.4 2000/05/18 19:24:59 bostic
* Bounded version of vsprintf.
*
* PUBLIC: #ifndef HAVE_VSNPRINTF
- * PUBLIC: int vsnprintf();
+ * PUBLIC: int vsnprintf __P((char *, size_t, const char *, va_list));
* PUBLIC: #endif
*/
#ifndef HAVE_VSNPRINTF