YAZ  5.34.0
Functions
marc_read_line.c File Reference

Implements reading of MARC in line format. More...

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <yaz/marcdisp.h>
#include <yaz/wrbuf.h>
#include <yaz/yaz-util.h>

Go to the source code of this file.

Functions

static int yaz_gets (int(*getbyte)(void *client_data), void(*ungetbyte)(int b, void *client_data), void *client_data, WRBUF w)
 
static int yaz_marc_line_gets (int(*getbyte)(void *client_data), void(*ungetbyte)(int b, void *client_data), void *client_data, WRBUF w)
 
int yaz_marc_read_line (yaz_marc_t mt, int(*getbyte)(void *client_data), void(*ungetbyte)(int b, void *client_data), void *client_data)
 read MARC lineformat from stream More...
 

Detailed Description

Implements reading of MARC in line format.

Definition in file marc_read_line.c.

Function Documentation

◆ yaz_gets()

static int yaz_gets ( int(*)(void *client_data)  getbyte,
void(*)(int b, void *client_data)  ungetbyte,
void *  client_data,
WRBUF  w 
)
static

Definition at line 27 of file marc_read_line.c.

References wrbuf_putc.

Referenced by yaz_marc_line_gets().

◆ yaz_marc_line_gets()

static int yaz_marc_line_gets ( int(*)(void *client_data)  getbyte,
void(*)(int b, void *client_data)  ungetbyte,
void *  client_data,
WRBUF  w 
)
static

Definition at line 60 of file marc_read_line.c.

References wrbuf_buf, wrbuf_cut_right(), wrbuf_len, wrbuf_puts(), wrbuf_rewind(), and yaz_gets().

Referenced by yaz_marc_read_line().

◆ yaz_marc_read_line()

int yaz_marc_read_line ( yaz_marc_t  mt,
int(*)(void *client_data)  getbyte,
void(*)(int b, void *client_data)  ungetbyte,
void *  client_data 
)

read MARC lineformat from stream

Parameters
mthandle
getbyteget one byte handler
ungetbyteunget one byte handler
client_dataopaque data for handers
Return values
-1ERROR
>0OK (length)

Parses MARC line record from stream Returns > 0 for OK (same as length), -1=ERROR

Definition at line 95 of file marc_read_line.c.

References atoi_n_check(), wrbuf_alloc(), wrbuf_cstr(), wrbuf_destroy(), yaz_marc_add_controlfield(), yaz_marc_add_datafield(), yaz_marc_add_subfield(), yaz_marc_cprintf(), yaz_marc_line_gets(), yaz_marc_reset(), and yaz_marc_set_leader().