projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added turbo marcxml read and write
[yaz-moved-to-github.git]
/
ztest
/
read-marc.c
diff --git
a/ztest/read-marc.c
b/ztest/read-marc.c
index
cecbabc
..
09fecc7
100644
(file)
--- a/
ztest/read-marc.c
+++ b/
ztest/read-marc.c
@@
-1,16
+1,19
@@
/* This file is part of the YAZ toolkit.
/* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2008 Index Data
+ * Copyright (C) 1995-2010 Index Data
* See the file LICENSE for details.
*/
* See the file LICENSE for details.
*/
-/*
- * Little toy-thing to read a MARC records from a fixed array.
+/** \file
+ * \brief Little toy-thing to read MARC records from a file or fixed array.
*/
*/
+
#include <ctype.h>
#include <yaz/wrbuf.h>
#include <yaz/marcdisp.h>
#include <yaz/odr.h>
#include <ctype.h>
#include <yaz/wrbuf.h>
#include <yaz/marcdisp.h>
#include <yaz/odr.h>
+#include "ztest.h"
+
char *marc_records[] = {
"\x30\x30\x33\x36\x36\x6E\x61\x6D\x20\x20\x32\x32\x30\x30\x31\x36"
char *marc_records[] = {
"\x30\x30\x33\x36\x36\x6E\x61\x6D\x20\x20\x32\x32\x30\x30\x31\x36"
@@
-1572,15
+1575,12
@@
char *dummy_marc_record (int num, ODR odr)
FILE *inf;
char *buf = 0;
FILE *inf;
char *buf = 0;
- if (num == 98)
- { /* this will generate a very bad MARC record (testing only) */
- buf = (char*) odr_malloc(odr, 2101);
- memset(buf, '7', 2100);
- buf[2100] = '\0';
- }
inf = fopen ("dummy-records", "r");
if (!inf)
{ /* file not there. Get them from fixed array */
inf = fopen ("dummy-records", "r");
if (!inf)
{ /* file not there. Get them from fixed array */
+ if (num < 1)
+ return 0;
+ return marc_records[(num-1) % 24];
if (num < 1 || num > 24)
return 0;
return marc_records[num-1];
if (num < 1 || num > 24)
return 0;
return marc_records[num-1];
@@
-1622,6
+1622,7
@@
char *dummy_xml_record (int num, ODR odr)
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab