X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fmarcdisp.c;h=54ad37b539e400bac3988bc42e998148e4d31a28;hp=321cd7273bab6137054f141303c7d99b07fc332c;hb=cd2f012a70ebadf660acb71936e32192287dc30a;hpb=54db174ec4113c44b05f3766dc6f8ad665968cfb diff --git a/src/marcdisp.c b/src/marcdisp.c index 321cd72..54ad37b 100644 --- a/src/marcdisp.c +++ b/src/marcdisp.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: marcdisp.c,v 1.38 2006-12-15 12:37:18 adam Exp $ + * $Id: marcdisp.c,v 1.39 2006-12-15 19:28:47 adam Exp $ */ /** @@ -267,10 +267,12 @@ void yaz_marc_add_subfield(yaz_marc_t mt, } } -static int atoi_n_check(const char *buf, int size, int *val) +int atoi_n_check(const char *buf, int size, int *val) { - if (!isdigit(*(const unsigned char *) buf)) - return 0; + int i; + for (i = 0; i < size; i++) + if (!isdigit(i[(const unsigned char *) buf])) + return 0; *val = atoi_n(buf, size); return 1; } @@ -491,6 +493,7 @@ int yaz_marc_write_line(yaz_marc_t mt, WRBUF wr) wrbuf_printf(wr, "%s\n", n->u.leader); } } + wrbuf_puts(wr, "\n"); return 0; } @@ -927,6 +930,20 @@ static int marc_exec_leader(const char *leader_spec, char *leader, size_t size) return 0; } +int yaz_marc_decode_formatstr(const char *arg) +{ + int mode = -1; + if (!strcmp(arg, "marc")) + mode = YAZ_MARC_ISO2709; + if (!strcmp(arg, "marcxml")) + mode = YAZ_MARC_MARCXML; + if (!strcmp(arg, "marcxchange")) + mode = YAZ_MARC_XCHANGE; + if (!strcmp(arg, "line")) + mode = YAZ_MARC_LINE; + return mode; +} + /* * Local variables: * c-basic-offset: 4