projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix comment about term_104, term_105 functions
[idzebra-moved-to-github.git]
/
bfile
/
tstbfile2.c
diff --git
a/bfile/tstbfile2.c
b/bfile/tstbfile2.c
index
44ab3ca
..
48609f3
100644
(file)
--- a/
bfile/tstbfile2.c
+++ b/
bfile/tstbfile2.c
@@
-1,8
+1,5
@@
-/* $Id: tstbfile2.c,v 1.2 2006-11-08 13:05:33 adam Exp $
- Copyright (C) 1995-2006
- Index Data ApS
-
-This file is part of the Zebra server.
+/* This file is part of the Zebra server.
+ Copyright (C) 1994-2011 Index Data
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-20,6
+17,9
@@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
@@
-80,12
+80,13
@@
void tst(void)
YAZ_CHECK_EQ(r, ZEBRA_OK);
#endif
YAZ_CHECK_EQ(r, ZEBRA_OK);
#endif
+ yaz_log(YLOG_LOG, "writing file 1");
bf = bf_open(bfs, "file", block_size, 1);
YAZ_CHECK(bf);
if (bf)
{
zint bno[2];
bf = bf_open(bfs, "file", block_size, 1);
YAZ_CHECK(bf);
if (bf)
{
zint bno[2];
- memset(buf, '\0', block_size);
+ memset(buf, ' ', block_size);
bno[0] = 0;
bno[1] = 1;
bno[0] = 0;
bno[1] = 1;
@@
-102,6
+103,7
@@
void tst(void)
bf_close(bf);
}
bf_close(bf);
}
+ yaz_log(YLOG_LOG, "reading file 1");
bf = bf_open(bfs, "file", block_size, 0);
YAZ_CHECK(bf);
if (bf)
bf = bf_open(bfs, "file", block_size, 0);
YAZ_CHECK(bf);
if (bf)
@@
-113,7
+115,7
@@
void tst(void)
while (bno[0] < max_block)
{
zint next = bno[0] + bno[1];
while (bno[0] < max_block)
{
zint next = bno[0] + bno[1];
- memset(buf, '\0', block_size);
+ memset(buf, ' ', block_size);
YAZ_CHECK_EQ(bf_read(bf, bno[0], 0, 0, buf), 1);
YAZ_CHECK_EQ(atoi(buf), bno[0]);
YAZ_CHECK_EQ(bf_read(bf, bno[0], 0, 0, buf), 1);
YAZ_CHECK_EQ(atoi(buf), bno[0]);
@@
-125,6
+127,7
@@
void tst(void)
}
#if 1
}
#if 1
+ yaz_log(YLOG_LOG, "writing file 2");
bf = bf_open(bfs, "file", block_size, 1);
YAZ_CHECK(bf);
if (bf)
bf = bf_open(bfs, "file", block_size, 1);
YAZ_CHECK(bf);
if (bf)
@@
-132,7
+135,7
@@
void tst(void)
zint bno = 0;
while (bno < max_block)
{
zint bno = 0;
while (bno < max_block)
{
- memset(buf, '\0', block_size);
+ memset(buf, ' ', block_size);
sprintf(buf, ZINT_FORMAT, bno);
YAZ_CHECK_EQ(bf_write(bf, bno, 0, 0, buf), 0);
sprintf(buf, ZINT_FORMAT, bno);
YAZ_CHECK_EQ(bf_write(bf, bno, 0, 0, buf), 0);
@@
-142,19
+145,22
@@
void tst(void)
bf_close(bf);
}
bf_close(bf);
}
+ yaz_log(YLOG_LOG, "reading file 2");
bf = bf_open(bfs, "file", block_size, 0);
YAZ_CHECK(bf);
if (bf)
{
zint bno = 0;
bf = bf_open(bfs, "file", block_size, 0);
YAZ_CHECK(bf);
if (bf)
{
zint bno = 0;
+ int step = max_block / 50;
+
while (bno < max_block)
{
while (bno < max_block)
{
- memset(buf, '\0', block_size);
+ memset(buf, ' ', block_size);
YAZ_CHECK_EQ(bf_read(bf, bno, 0, 0, buf), 1);
YAZ_CHECK_EQ(atoi(buf), bno);
YAZ_CHECK_EQ(bf_read(bf, bno, 0, 0, buf), 1);
YAZ_CHECK_EQ(atoi(buf), bno);
- bno = bno + 2;
+ bno = bno + 2*step;
}
bf_close(bf);
}
}
bf_close(bf);
}
@@
-166,6
+172,7
@@
void tst(void)
int main(int argc, char **argv)
{
YAZ_CHECK_INIT(argc, argv);
int main(int argc, char **argv)
{
YAZ_CHECK_INIT(argc, argv);
+ YAZ_CHECK_LOG();
tst();
YAZ_CHECK_TERM;
}
tst();
YAZ_CHECK_TERM;
}