mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-10 15:20:10 +00:00
c06a49c551
2001-08-27 Ulrich Drepper <drepper@redhat.com> * misc/syslog.c (vsyslog): Try a bit harder to use syslogd. If the connection went down after we first used it try to connect again and resend the message before printing to the console. Reported by Coserea Gh. Tudor <tudore@tudore.gecadsoftware.com>. 2001-08-27 Jakub Jelinek <jakub@redhat.com> * string/tst-strlen.c (main): Test strnlen (, -1) too. * sysdeps/generic/strnlen.c (__strnlen): Fix for maxlens with top bit set. 2001-08-27 Ulrich Drepper <drepper@redhat.com> * iconv/strtab.c (searchstring): Use correct length for comparison. (strtabadd): Account total size correct if new string has old string as substring.
46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
/* Make sure we don't test the optimized inline functions if we want to
|
|
test the real implementation. */
|
|
#undef __USE_STRING_INLINES
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
static const size_t lens[] = { 0, 1, 0, 2, 0, 1, 0, 3,
|
|
0, 1, 0, 2, 0, 1, 0, 4 };
|
|
char basebuf[24 + 32];
|
|
size_t base;
|
|
|
|
for (base = 0; base < 32; ++base)
|
|
{
|
|
char *buf = basebuf + base;
|
|
size_t words;
|
|
|
|
for (words = 0; words < 4; ++words)
|
|
{
|
|
size_t last;
|
|
memset (buf, 'a', words * 4);
|
|
|
|
for (last = 0; last < 16; ++last)
|
|
{
|
|
buf[words * 4 + 0] = (last & 1) != 0 ? 'b' : '\0';
|
|
buf[words * 4 + 1] = (last & 2) != 0 ? 'c' : '\0';
|
|
buf[words * 4 + 2] = (last & 4) != 0 ? 'd' : '\0';
|
|
buf[words * 4 + 3] = (last & 8) != 0 ? 'e' : '\0';
|
|
buf[words * 4 + 4] = '\0';
|
|
|
|
if (strlen (buf) != words * 4 + lens[last]
|
|
|| strnlen (buf, -1) != words * 4 + lens[last])
|
|
{
|
|
printf ("failed for base=%Zu, words=%Zu, and last=%Zu\n",
|
|
base, words, last);
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|