0001 BFIND(3)
0002 ========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bfindlast - find the last value and occurrence of the field in UBF buffer
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 char * Bfindlast (UBFH *'p_ub', BFLDID 'bfldid', BFLDOCC *'occ', BFLDLEN *'len');
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 Function on success returns pointer to data field present in UBF buffer. 'p_ub'
0023 is pointer to UBF buffer, 'bfldid' is field id, 'occ' is field occurrence at
0024 which last field was found. 'occ' can be NULL, in that case the occurrence
0025 value is not returned. 'p_len' is output parameter for indicating the type
0026 length in bytes. Then 'len' is optional. Note that pointer to field is valid
0027 only that time while the buffer is not changed. If changes occur, then
0028 returned pointer might become invalid (point wrong data area).
0029
0030 Pointer for *BFLD_VIEW* type has additional limitation - this pointer is only
0031 valid until there is next call to Bfindlast() as function stores in Thread Local
0032 Storage initialized *BVIEWFLD* variable.
0033
0034 Difference between *Bfind(3)* is that this function returns the last occurrence in 'occ' variable instead of consuming the 'occ' to return exact field.
0035
0036 RETURN VALUE
0037 ------------
0038 On success, *Bfindlast()* return zero; on error, -1 is returned, with *Berror* set to indicate the error.
0039
0040 ERRORS
0041 ------
0042 Note that *Bstrerror()* returns generic error message plus custom message with debug info from last function call.
0043
0044 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0045
0046 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0047
0048 *BNOTPRES* Field not present.
0049
0050 *BBADFLD* Invalid field id passed in.
0051
0052 EXAMPLE
0053 -------
0054 See *ubftest/test_find.c* for sample code.
0055
0056 BUGS
0057 ----
0058 Report bugs to support@mavimax.com
0059
0060 SEE ALSO
0061 --------
0062 *Bchg(3)* *Badd(3)* *CBadd(3)* *Bfind(3)* *CBfind(3)*
0063
0064 COPYING
0065 -------
0066 (C) Mavimax, Ltd
0067