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
No more manifest files
[yaz-moved-to-github.git]
/
util
/
marcdump.c
diff --git
a/util/marcdump.c
b/util/marcdump.c
index
850331b
..
adfc015
100644
(file)
--- a/
util/marcdump.c
+++ b/
util/marcdump.c
@@
-46,6
+46,7
@@
#include <yaz/yaz-util.h>
#include <yaz/xmalloc.h>
#include <yaz/options.h>
#include <yaz/yaz-util.h>
#include <yaz/xmalloc.h>
#include <yaz/options.h>
+#include <yaz/backtrace.h>
#ifndef SEEK_SET
#define SEEK_SET 0
#ifndef SEEK_SET
#define SEEK_SET 0
@@
-319,6
+320,7
@@
static void dump(const char *fname, const char *from, const char *to,
size_t len_result;
size_t r;
char buf[100001];
size_t len_result;
size_t r;
char buf[100001];
+ yaz_iconv_t cd1 = 0;
r = fread(buf, 1, 5, inf);
if (r < 5)
r = fread(buf, 1, 5, inf);
if (r < 5)
@@
-428,7
+430,21
@@
static void dump(const char *fname, const char *from, const char *to,
}
}
len_result = rlen;
}
}
len_result = rlen;
+
+ if (yaz_marc_check_marc21_coding(from, buf, 26))
+ {
+ cd1 = yaz_iconv_open(to, "utf-8");
+ if (cd1)
+ yaz_marc_iconv(mt, cd1);
+ }
r = yaz_marc_decode_buf(mt, buf, -1, &result, &len_result);
r = yaz_marc_decode_buf(mt, buf, -1, &result, &len_result);
+
+ if (cd1)
+ {
+ yaz_iconv_close(cd1);
+ yaz_marc_iconv(mt, cd);
+ }
+
if (r == -1)
no_errors++;
if (r > 0 && result && len_result)
if (r == -1)
no_errors++;
if (r > 0 && result && len_result)
@@
-507,6
+523,7
@@
int main (int argc, char **argv)
#endif
prog = *argv;
#endif
prog = *argv;
+ yaz_enable_panic_backtrace(prog);
while ((r = options("i:o:C:npc:xOeXIf:t:s:l:Vv", argv, argc, &arg)) != -2)
{
no++;
while ((r = options("i:o:C:npc:xOeXIf:t:s:l:Vv", argv, argc, &arg)) != -2)
{
no++;