0001 BEXTREAD(3)
0002 ===========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bextread - Restore the buffer from printed text stream
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 int Bextread (UBFH *'p_ub', FILE *'inf');
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 Restore the buffer from text populated by *Bprint(3)*, *Bfprint(3)* or *Bfprintcb(3)*
0023
0024 The read format is "[COMMAND]<FIELD><TAB><VALUE><NEW_LINE>". Input also
0025 support fields by id, then format for <FIELD> is "((BFLDID32)<FIELD_ID>)"
0026
0027 To enable processing of *BFLD_PTR* fields, *ex_env(5)* configuration parameter
0028 *NDRX_APIFLAGS* shall contain flag *ubf_ptrparse*.
0029
0030 Sample buffer:
0031
0032 --------------------------------------------------------------------------------
0033 T_SHORT_FLD 1765
0034 T_LONG_FLD 3333111
0035 T_LONG_FLD 2
0036 T_CHAR_FLD A
0037 T_FLOAT_FLD 1.33000
0038 T_DOUBLE_FLD 1111.220000
0039 T_DOUBLE_FLD 333.000000
0040 T_DOUBLE_FLD 444.000000
0041 T_STRING_FLD HELLO WORLD
0042 T_CARRAY_FLD \00\01\02\03HELLO BINARY\04\05\00\\
0043 ((BFLDID32)167772261) HELLOSVC
0044 T_PTR_FLD 0xffff
0045 T_UBF_FLD
0046 T_STRING_FLD HELLO WORLD SUB FIELD
0047 T_FLOAT_FLD 1.33000
0048 T_VIEW_FLD UBTESTVIEW2
0049 tshort1 4
0050 tlong1 5
0051 tchar1 6
0052 tfloat1 7.00000
0053 tdouble1 8.000000
0054 tstring1 D
0055 tcarray1 F\00\00\00\00\00\00\00\00\00
0056 --------------------------------------------------------------------------------
0057
0058 'p_ub' is buffer to write the data to, 'inf' is input stream.
0059
0060 Input format supports also macro commands. This is optional *COMMAND* block,
0061 that can have following values:
0062
0063 *+* set the field value at occurrence 0.
0064
0065 *-* delete field from buffer.
0066
0067 *=* copy the field value from field name which is stored at <VALUE>.
0068
0069 *#* comment, line ignored
0070
0071 For example:
0072
0073 --------------------------------------------------------------------------------
0074 # Set the field value
0075 T_SHORT_FLD 123
0076 # Copy the value from T_SHORT_FLD to T_LONG_FLD
0077 =T_LONG_FLD T_SHORT_FLD
0078 # Change the occurrence 0 to 444
0079 +T_SHORT_FLD 444
0080 --------------------------------------------------------------------------------
0081
0082 The final buffer will be:
0083
0084 --------------------------------------------------------------------------------
0085 T_SHORT_FLD 444
0086 T_LONG_FLD 123
0087 --------------------------------------------------------------------------------
0088
0089 This format is used by *ud(8)* command line utility which allows to send
0090 arbitrary buffer to specified service.
0091
0092 RETURN VALUE
0093 ------------
0094 On success, *Bextread()* return zero; on error, -1 is returned, with
0095 *Berror* set to indicate the error.
0096
0097 ERRORS
0098 ------
0099 Note that *Bstrerror()* returns generic error message plus custom message with
0100 debug info from last function call.
0101
0102 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0103
0104 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0105
0106 *BEINVAL* 'inf' is NULL.
0107
0108 *BSYNTAX* Missing tab between field id or missing newline.
0109
0110 *BBADNAME* Field not found in field table.
0111
0112 *BBADVIEW* View not found (specified in view field)
0113
0114 EXAMPLE
0115 -------
0116 See *ubftest/test_print.c* for sample code.
0117
0118 BUGS
0119 ----
0120 Report bugs to support@mavimax.com
0121
0122 SEE ALSO
0123 --------
0124 *Bextreadcb(3)* *Bfprint(3)* *Bprint(3)* *Bfprintcb(3)* *Bread(3)* *Bwrite(3)* *ud(8)* *ex_env(5)*
0125
0126 COPYING
0127 -------
0128 (C) Mavimax, Ltd
0129