- 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 */
- if (num < 1 || num > 24)
- return 0;
- return marc_records[num-1];
- }
- /* OK, try to get proper MARC records from the file */
- while (--num >= 0)
- {
- buf = marc_read (inf, odr);
- if (!buf)
- break;
- }
- fclose(inf);
- return buf;
+static char *dummy_pz2_record(int num, ODR odr)
+{
+ const char *rec[] = {
+ PZ_CBEGIN
+ PZ_BEGIN
+ PZ_METADATA(author,"Jack Collins")
+ PZ_METADATA(medium, "book")
+ PZ_METADATA(date, "1995")
+ PZ_METADATA(title, "How to program a computer vol1")
+ PZ_END
+ PZ_BEGIN
+ PZ_METADATA(author,"Jack Collins")
+ PZ_METADATA(medium, "book")
+ PZ_METADATA(date, "1995")
+ PZ_METADATA(title, "How to program a computer vol2")
+ PZ_END
+ PZ_CEND
+ ,
+ PZ_CBEGIN
+ PZ_BEGIN
+ PZ_METADATA(author,"Jack Collins")
+ PZ_METADATA(medium, "book")
+ PZ_METADATA(date, "1995")
+ PZ_METADATA(title, "How to program a computer vol3")
+ PZ_END
+ PZ_BEGIN
+ PZ_METADATA(author,"Jack Collins")
+ PZ_METADATA(medium, "book")
+ PZ_METADATA(date, "1995")
+ PZ_METADATA(title, "How to program a computer vol2")
+ PZ_END
+ PZ_CEND
+ ,
+ PZ_BEGIN
+ PZ_METADATA(author,"Jack Collins")
+ PZ_METADATA(medium, "book")
+ PZ_METADATA(date, "1995")
+ PZ_METADATA(title, "How to program a computer vol1")
+ PZ_END
+ ,
+ /* identical to first */
+ PZ_CBEGIN
+ PZ_BEGIN
+ PZ_METADATA(author,"Jack Collins")
+ PZ_METADATA(medium, "book")
+ PZ_METADATA(date, "1995")
+ PZ_METADATA(title, "How to program a computer vol1")
+ PZ_END
+ PZ_BEGIN
+ PZ_METADATA(author,"Jack Collins")
+ PZ_METADATA(medium, "book")
+ PZ_METADATA(date, "1995")
+ PZ_METADATA(title, "How to program a computer vol4")
+ PZ_END
+ PZ_CEND
+ };
+ if (num > 0 && num <= sizeof(rec)/sizeof(*rec))
+ return odr_strdup(odr, rec[num - 1]);
+ return 0;