* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
- * $Id: marcdisp.h,v 1.15 2006-04-19 10:05:02 adam Exp $
+ * $Id: marcdisp.h,v 1.16 2006-04-20 19:47:01 adam Exp $
*/
/**
YAZ_EXPORT void yaz_marc_subfield_str(yaz_marc_t mt, const char *s);
YAZ_EXPORT void yaz_marc_endline_str(yaz_marc_t mt, const char *s);
+/** \brief modifies part of the MARC leader */
+YAZ_EXPORT void yaz_marc_modify_leader(yaz_marc_t mt, size_t off,
+ const char *str);
+
/** \brief like atoi except that it reads exactly len characters */
YAZ_EXPORT int atoi_n(const char *buf, int len);
* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: marcdisp.c,v 1.26 2006-04-19 10:05:03 adam Exp $
+ * $Id: marcdisp.c,v 1.27 2006-04-20 19:47:01 adam Exp $
*/
/**
int yaz_marc_write_marcxml(yaz_marc_t mt, WRBUF wr)
{
+ yaz_marc_modify_leader(mt, 9, "a");
return yaz_marc_write_marcxml_ns(mt, wr, "http://www.loc.gov/MARC21/slim");
}
mt->iconv_cd = cd;
}
+void yaz_marc_modify_leader(yaz_marc_t mt, size_t off, const char *str)
+{
+ struct yaz_marc_node *n;
+ char *leader = 0;
+ for (n = mt->nodes; n; n = n->next)
+ if (n->which == YAZ_MARC_LEADER)
+ {
+ leader = n->u.leader;
+ memcpy(leader+off, str, strlen(str));
+ break;
+ }
+}
+
/* deprecated */
int yaz_marc_decode(const char *buf, WRBUF wr, int debug, int bsize, int xml)
{
<record xmlns="http://www.loc.gov/MARC21/slim">
<!-- Length implementation at offset 22 should hold a digit. Assuming 0 -->
- <leader>00988nam0 32003011 450 </leader>
+ <leader>00988nam0a32003011 450 </leader>
<datafield tag="001" ind1="0" ind2="0" ind3="0">
<subfield code="a">9 181 423 4</subfield>
<subfield code="b">710100</subfield>
-00989nam0 32003011 450 001002800000004001000028008002800038009001100066021002700077032001500104100002100119245005400140250004100194260004000235300002700275504012300302512006100425520005000486652002400536652001600560666001600576666001900592666001500611666001800626666001900644666000900663666001500672\1e000\1fa9 181 423 4\1fb710100\1ffa\1e000\1frn\1fae\1e000\1ftm\1fuu\1fa2002\1fbus\1fleng\1fv0\1e000\1faa\1fgxx\1e000\1fa1-4000-4596-7\1fd$14,00\1e000\1f&DBC200439\1e000\1f0\1faSloman\1fhLarry\1e000\1faOn the road with Bob Dylan\1feLarry "Ratso" Sloman\1e000\1faRevised edition\1fbThree Rivers Press\1e000\1faNew York\1fbThree Rivers Press\1fc2002\1e000\1faxv, 464 sider, tavler\1e000\1faLarry "Ratso" Slomans meget personlige beretning om Bob Dylans koncertturne i USA i 1975: "The Rolling Thunder revue"\1e000\1faPå omslaget: With a new introduction by Kinky Friedman\1e000\1faTidligere: 1. udgave. New York, Bantam, 1978\1e000\1f0\1fm99.4\1faDylan\1fhBob\1e000\1fp78.9064\1fv5\1e000\1fffolkemusik\1e000\1fffolkemusikere\1e000\1ffrockmusik\1e000\1ffrockmusikere\1e000\1ffrockkoncerter\1e000\1feUSA\1e000\1fi1970-1979\1e\1d
\ No newline at end of file
+00989nam0a32003011 450 001002800000004001000028008002800038009001100066021002700077032001500104100002100119245005400140250004100194260004000235300002700275504012300302512006100425520005000486652002400536652001600560666001600576666001900592666001500611666001800626666001900644666000900663666001500672\1e000\1fa9 181 423 4\1fb710100\1ffa\1e000\1frn\1fae\1e000\1ftm\1fuu\1fa2002\1fbus\1fleng\1fv0\1e000\1faa\1fgxx\1e000\1fa1-4000-4596-7\1fd$14,00\1e000\1f&DBC200439\1e000\1f0\1faSloman\1fhLarry\1e000\1faOn the road with Bob Dylan\1feLarry "Ratso" Sloman\1e000\1faRevised edition\1fbThree Rivers Press\1e000\1faNew York\1fbThree Rivers Press\1fc2002\1e000\1faxv, 464 sider, tavler\1e000\1faLarry "Ratso" Slomans meget personlige beretning om Bob Dylans koncertturne i USA i 1975: "The Rolling Thunder revue"\1e000\1faPå omslaget: With a new introduction by Kinky Friedman\1e000\1faTidligere: 1. udgave. New York, Bantam, 1978\1e000\1f0\1fm99.4\1faDylan\1fhBob\1e000\1fp78.9064\1fv5\1e000\1fffolkemusik\1e000\1fffolkemusikere\1e000\1ffrockmusik\1e000\1ffrockmusikere\1e000\1ffrockkoncerter\1e000\1feUSA\1e000\1fi1970-1979\1e\1d
\ No newline at end of file
<record xmlns="http://www.loc.gov/MARC21/slim">
<!-- Length implementation at offset 22 should hold a digit. Assuming 0 -->
- <leader>01116nam0 32002171 450 </leader>
+ <leader>01116nam0a32002171 450 </leader>
<datafield tag="001" ind1="0" ind2="0" ind3="0">
<subfield code="a">9 182 502 3</subfield>
<subfield code="b">710100</subfield>
-01121nam0 32002171 450 001002800000004001000028008002800038009001100066039000900077100001900086245005900105260003300164300001000197512007300207531001400280538001900294652001500313666004900328795050600377795002000883\1e000\1fa9 182 502 3\1fb710100\1ffa\1e000\1frc\1fae\1e000\1fts\1fuf\1fa1995\1fbgb\1fleng\1fv0\1e000\1fas\1fgxc\1e000\1fabef\1e000\1faMimms\1fhGarnet\1e000\1faCry baby\1faWarm and soulful\1feGarnet Mimms ... [et al.]\1e000\1faBury St. Edmunds\1fbBGO\1fc1995\1e000\1fn1 cd\1e000\1faIndspilninger publiceret 1963 (Cry baby) og 1965 (Warm and soulful)\1e000\1faIndhold:\1e000\1ffBGO\1fgBGOCD268\1e000\1fm78.794\1fv4\1e000\1fmsoul\1fmrhythm & blues\1fnvokal\1fp1960-1969\1flUSA\1e000\1få11\1faCry baby\1faNobody but you\1faUntil you were gone\1faAnytime you want me\1faSo close\1faFor your precious love\1faBaby don't you weep\1faA ¤quiet place\1faCry to me\1faDon't change your heart\1faWanting you\1faThe ¤truth hurts\1faI'll take good care of you\1faLooking for you\1faIt won't hurt (half as much)\1faIt was easier to hurt her\1faThinkin'\1faProve it to me\1faMore than a miracle\1faAs long as I have you\1faOne girl\1faThere goes my baby\1faIt's just a matter of time\1faA ¤little bit of soap\1faLook away\1faI'll make it up to you\1e000\1få40\1fy0\1fa1 girl\1e\1d
\ No newline at end of file
+01121nam0a32002171 450 001002800000004001000028008002800038009001100066039000900077100001900086245005900105260003300164300001000197512007300207531001400280538001900294652001500313666004900328795050600377795002000883\1e000\1fa9 182 502 3\1fb710100\1ffa\1e000\1frc\1fae\1e000\1fts\1fuf\1fa1995\1fbgb\1fleng\1fv0\1e000\1fas\1fgxc\1e000\1fabef\1e000\1faMimms\1fhGarnet\1e000\1faCry baby\1faWarm and soulful\1feGarnet Mimms ... [et al.]\1e000\1faBury St. Edmunds\1fbBGO\1fc1995\1e000\1fn1 cd\1e000\1faIndspilninger publiceret 1963 (Cry baby) og 1965 (Warm and soulful)\1e000\1faIndhold:\1e000\1ffBGO\1fgBGOCD268\1e000\1fm78.794\1fv4\1e000\1fmsoul\1fmrhythm & blues\1fnvokal\1fp1960-1969\1flUSA\1e000\1få11\1faCry baby\1faNobody but you\1faUntil you were gone\1faAnytime you want me\1faSo close\1faFor your precious love\1faBaby don't you weep\1faA ¤quiet place\1faCry to me\1faDon't change your heart\1faWanting you\1faThe ¤truth hurts\1faI'll take good care of you\1faLooking for you\1faIt won't hurt (half as much)\1faIt was easier to hurt her\1faThinkin'\1faProve it to me\1faMore than a miracle\1faAs long as I have you\1faOne girl\1faThere goes my baby\1faIt's just a matter of time\1faA ¤little bit of soap\1faLook away\1faI'll make it up to you\1e000\1få40\1fy0\1fa1 girl\1e\1d
\ No newline at end of file
<record xmlns="http://www.loc.gov/MARC21/slim">
<!-- Length implementation at offset 22 should hold a digit. Assuming 0 -->
- <leader>00914naa 2200337 450 </leader>
+ <leader>00914naa a2200337 450 </leader>
<datafield tag="001" ind1=" " ind2=" ">
<subfield code="a">a00001508</subfield>
<subfield code="f">a</subfield>
-00914naa 2200337 450 001001700000004000900017008002400026009001000050041000800060041000800068097000700076245003300083300002600116557003300142630001600175630001300191633001000204633000900214648006100223648001600284648005400300J01000600354BAS000500360LKR004200365CAT003000407CAT003000437CAT003000467CAT003900497CAT002600536UID001400562\1e \1faa00001508\1ffa\1e \1fai\1frn\1e \1fa1991\1fbxx\1flnor\1fta\1fv9\1e \1faa\1fgxx\1e \1fanor\1e \1fdeng\1e00\1fa06\1e \1faByfornyelse ved Ibsen-Ringen\1e \1fbfarvefoto\1fbplan\1fbsnit\1e \1faByggekunst\1fj1991\1fv1/2\1fk41-45\1e \1ffbyfornyelse\1e \1ffsanering\1e \1ffNorge\1e \1ffOslo\1e \1faTelje Torp Aasen Arkitektkontor\1fcKristian Augustsgate 7B\1e \1faEng, Dagfin\1e \1franlund, Tom\1fcKristian Augustsgate\1fcPilestredet 19\1e \1faa\1e \1f0\1e \1faITM\1flARK50\1fb0000145\1fy1991\1fi1/2\1fk41-45\1e \1fa\1fb\1fc20020111\1flARK01\1fh2002\1e \1fa\1fb\1fc20020111\1flARK01\1fh2116\1e \1fa\1fb\1fc20021002\1flARK01\1fh1000\1e \1faICLLOAD\1fb00\1fc20021122\1flARK01\1fh1948\1e \1fc20030618\1flARK01\1fh1330\1e \1faa00001508\1e\1d
\ No newline at end of file
+00914naa a2200337 450 001001700000004000900017008002400026009001000050041000800060041000800068097000700076245003300083300002600116557003300142630001600175630001300191633001000204633000900214648006100223648001600284648005400300J01000600354BAS000500360LKR004200365CAT003000407CAT003000437CAT003000467CAT003900497CAT002600536UID001400562\1e \1faa00001508\1ffa\1e \1fai\1frn\1e \1fa1991\1fbxx\1flnor\1fta\1fv9\1e \1faa\1fgxx\1e \1fanor\1e \1fdeng\1e00\1fa06\1e \1faByfornyelse ved Ibsen-Ringen\1e \1fbfarvefoto\1fbplan\1fbsnit\1e \1faByggekunst\1fj1991\1fv1/2\1fk41-45\1e \1ffbyfornyelse\1e \1ffsanering\1e \1ffNorge\1e \1ffOslo\1e \1faTelje Torp Aasen Arkitektkontor\1fcKristian Augustsgate 7B\1e \1faEng, Dagfin\1e \1franlund, Tom\1fcKristian Augustsgate\1fcPilestredet 19\1e \1faa\1e \1f0\1e \1faITM\1flARK50\1fb0000145\1fy1991\1fi1/2\1fk41-45\1e \1fa\1fb\1fc20020111\1flARK01\1fh2002\1e \1fa\1fb\1fc20020111\1flARK01\1fh2116\1e \1fa\1fb\1fc20021002\1flARK01\1fh1000\1e \1faICLLOAD\1fb00\1fc20021122\1flARK01\1fh1948\1e \1fc20030618\1flARK01\1fh1330\1e \1faa00001508\1e\1d
\ No newline at end of file
<!-- Identifier length at offset 11 should hold a digit. Assuming 2 -->
<!-- Base address at offsets 12..16 should hold a number. Assuming 0 -->
<!-- Length implementation at offset 22 should hold a digit. Assuming 0 -->
- <leader>009140091422a 22003370 </leader>
+ <leader>009140091a22a 22003370 </leader>
<!-- Directory offset 24: Bad value for data length and/or length starting -->
<!-- Base address not at end of directory, base 0, end 25 -->
</record>
-00026009142200025003370 \1e\1d
\ No newline at end of file
+000260091a2200025003370 \1e\1d
\ No newline at end of file
<record xmlns="http://www.loc.gov/MARC21/slim">
- <leader>00366nam 22001698a 4500</leader>
+ <leader>00366nam a22001698a 4500</leader>
<controlfield tag="001"> 11224466 </controlfield>
<controlfield tag="003">DLC</controlfield>
<controlfield tag="005">00000000000000.0</controlfield>
-00366nam 22001698a 4500001001300000003000400013005001700017008004100034010001700075040001300092050001200105100001700117245003000134260001200164263000900176300001100185\1e 11224466 \1eDLC\1e00000000000000.0\1e910710c19910701nju 00010 eng \1e \1fa 11224466 \1e \1faDLC\1fcDLC\1e00\1fa123-xyz\1e10\1faJack Collins\1e10\1faHow to program a computer\1e1 \1faPenguin\1e \1fa8710\1e \1fap. cm.\1e\1d
\ No newline at end of file
+00366nam a22001698a 4500001001300000003000400013005001700017008004100034010001700075040001300092050001200105100001700117245003000134260001200164263000900176300001100185\1e 11224466 \1eDLC\1e00000000000000.0\1e910710c19910701nju 00010 eng \1e \1fa 11224466 \1e \1faDLC\1fcDLC\1e00\1fa123-xyz\1e10\1faJack Collins\1e10\1faHow to program a computer\1e1 \1faPenguin\1e \1fa8710\1e \1fap. cm.\1e\1d
\ No newline at end of file
#!/bin/sh
-# $Id: tstmarciso.sh,v 1.1 2006-04-19 10:05:04 adam Exp $
+# $Id: tstmarciso.sh,v 1.2 2006-04-20 19:47:02 adam Exp $
# Tests reading of ISO2709 and checks that we get identical MARCXML
srcdir=${srcdir:-.}
ecode=0
DIFF=`basename ${f}`.diff
../util/yaz-marcdump -f `cat ${f}.chr` -t utf-8 -X $f > $NEW
if test $? != "0"; then
- echo "Failed decode of $f"
+ echo "$f: yaz-marcdump returned error"
ecode=1
elif test -f $OLD; then
if diff $OLD $NEW >$DIFF; then
rm $DIFF
rm $NEW
else
- echo "Differ in $f"
+ echo "$f: $NEW and $OLD differ"
ecode=1
fi
else
- echo "Making test $f for the first time"
+ echo "$f: Making test result $OLD for the first time"
if test -x /usr/bin/xmllint; then
if xmllint --noout $NEW >out 2>stderr; then
- echo "XML for $f is OK"
+ echo "$f: $NEW is well-formed"
mv $NEW $OLD
else
- echo "XML for $f is invalid"
+ echo "$f: $NEW not well-formed"
ecode=1
fi
else
#!/bin/sh
-# $Id: tstmarcxml.sh,v 1.1 2006-04-19 10:05:04 adam Exp $
+# $Id: tstmarcxml.sh,v 1.2 2006-04-20 19:47:02 adam Exp $
# Tests reading of MARCXML and checks that we get identical ISO2709 output.
srcdir=${srcdir:-.}
ecode=0
rm $DIFF
rm $NEW
else
- echo "Differ in $f"
+ echo "$f: $NEW and $OLD Differ"
ecode=1
fi
else
- echo "Making test $f for the first time"
+ echo "$f: Making test result $OLD for the first time"
mv $NEW $OLD
fi
done